Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
end
end
code = [code sprintf('%send\n',space)];
end
end
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
end
end
if(~isempty(elsecell))
code = [code sprintf('%selse\n',space)];
if (~isempty(g2.cells(elseindex).subgrid))
code = [code obj.generate_code(g1,g2.cells(elseindex).subgrid,depth+1)];
else
depth = depth + 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
found1 = 0;
for j=1:size(g1.cells,2)
g1cond = get(g1.cells(j).cond,'String');
elsecell1 = g1.cells(j);
found1 = 1;
continue
end
if(~isempty(g1.cells(j).subgrid))
%%TODO if add more dimensions to grid1
else
if (~isempty(g1cond1))
if (j == 1 || (j==2 && found1 == 1))
code = [code sprintf('%sif(%s)\n',space,strtrim(char(get(g1.cells(j).cond,'String'))))];
else
code = [code sprintf('%selseif(%s)\n',space,strtrim(char(get(g1.cells(j).cond,'String'))))];
end
end
cell = obj.Grid0.search_return(g1.cells(j),g2.cells(elseindex));
if(~isempty(cell))
depth = depth + 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))]
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
else
depth = depth + 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
code = [code sprintf('%smissing!!!\n',space)];
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
end
end
end
if(~isempty(g1cond1))
if(size(g1.cells,2)>0)
if (~isempty(elsecell1))
code = [code sprintf('%selse\n',space)];
cell = obj.Grid0.search_return(elsecell1,g2.cells(elseindex));
if(~isempty(cell))
depth = depth + 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
code = [code sprintf('%soutput = %s;\n',space,strtrim(char(get(cell.result,'String'))))];
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
else
depth = depth + 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
code = [code sprintf('%smissing!!!\n',space)];
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
end
end
code = [code sprintf('%send\n',space)];
end
end
depth = depth - 1;
space = [];
for k=1:depth
space = [space sprintf(' ')];
end
end
end
code = [code sprintf('%send\n',space)];
end
end
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
%% save_conditions
% this function is used to save the strings that are in each of the
% condition edit boxes string field. We do this because when we
% want to reopen the gui we want to repopulate these fields but the
% handles to the edit boxes will disappear when we close the gui,
% so we need to save the strings into variables in each of the Cell
% objects. function is recursive.
% inputs:
% obj:GUI - current GUI object
% grid:Grid - grid to be saved.
% outputs;
% none
function [] = save_conditions(obj,grid)
for i=1:size(grid.cells,2)
if ~isempty(grid.cells(i).subgrid)
obj.save_conditions(grid.cells(i).subgrid);
end
grid.cells(i).cond_text = get(grid.cells(i).cond,'String');
end
end
%% save_results
% Save as save_conditions but for the results grid, since not a
% recursive datatype we do not need to recurse.
% inputs:
% obj:GUI - current GUI object
% grid:RGrid - results grid to be saved.
% outputs;
% none
function [] = save_results(obj,grid)
for i=1:size(grid.Cells,2)
grid.Cells(i).result_text = get(grid.Cells(i).result,'String');
end
end
%% close_fig
% callback function that is called whenever the close button is
% pressed.
% inputs:
% object - current GUI object
% src - source of the callback calling
% event - event that triggered the callback
% outputs;
% none
function [] = close_fig(object,src,event)
% save the relavent edit boxes to respective variables
save_conditions(object,object.Grid2);
save_conditions(object,object.Grid1);
save_results(object,object.Grid0);
Colin Eles
committed
% depricated
object.function_name_text = get(object.function_name_control,'String');
object.function_inputs_text = get(object.function_inputs_control,'String');
Colin Eles
committed
% new storage
object.Data.function_name = get(object.function_name_control,'String');
object.Data.function_inputs = get(object.function_inputs_control,'String');
Colin Eles
committed
object.Data.open = 0;
object.Data.fig = [];
set.set = 1;
set.inputs = object.settings.pvs_includes;
set.count = object.settings.counter_trials;
set.range = object.settings.counter_range;
object.Data.settings = set;
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
% delete the figure, closing the window.
delete(object.fig);
% remove reference to the old figure.
object.fig = [];
end
%% edit_tog_call
% callback function for when the edit button is clicked. when
% edit is toggled we want to redraw the table with the edit
% button visible or not visible
% inputs:
% object - current GUI object
% src - source of the callback calling
% event - event that triggered the callback
% outputs;
% none
function [] = edit_tog_call(object,src,event)
% save the value of the edit toggle
value = get(src,'Value');
object.edit = value;
% reset the widths and heights of the grid then redraw all the
% grids.
object.reset_wh;
object.draw_allgrids(0);
end
%% set_grid
% allows accessing objects to set the grid variables to the
% inputed objects
% inputs:
% obj:GUI - current GUI object
% grid2:Grid - Grid on the left
% grid1:Grid - Grid on the top
% grid0:RGrid - Results grid
% outputs;
% none
function [] = set_grid(obj,grid2,grid1,grid0)
obj.Grid2 = grid2;
obj.Grid1 = grid1;
obj.Grid0 = grid0;
end
%% draw_grid2
% Draws the grid on the left onto the figure.
% inputs:
% obj:GUI - current GUI object
% grid:Grid - grid to be drawn, should be grid on left.
% load:boolean - 0 if grid is being refreshed, 1 if grid is being
% loaded for the firs time.
% outputs;
% none
function [] = draw_grid2(obj,grid,load)
if (~isempty(grid))
% generate a random pastel colour for the background, each
% grid has a different colour to help with readability
grid_color = [0.9+0.1*rand(1) 0.9+0.1*rand(1) 0.9+0.1*rand(1)];
for i=1:size(grid.cells,2)
% check if the grid is the root grid
if (~isempty(grid.parent_cell))
% grid is not the root grid location is derived
% from its parent.
parent_pos = grid.parent_cell.get_pos;
if i == 1
% if we are at the first cell, location is the
% same as the parent but shifted to the right
% by one cell
pos(3) = grid.cells(i).width * grid.cells(i).condition_text_width;
pos(4) = grid.cells(i).height * grid.cells(i).condition_text_height;
pos(1) = parent_pos(1) + parent_pos(3);
pos(2) = parent_pos(2) + parent_pos(4) - pos(4);
else
% if we are not at the first cell, location is
% the same as the previous cell but we shift
% down by one cell
prev_pos = grid.cells(i-1).get_pos;
pos(3) = grid.cells(i).width * grid.cells(i).condition_text_width;
pos(4) = grid.cells(i).height * grid.cells(i).condition_text_height;
pos(1) = parent_pos(1) + parent_pos(3);
pos(2) = prev_pos(2) - pos(4);
grid_color = grid.cells(i-1).color;
end
else
% grid is the root grid.
% position of the first cell is based on
% condition_text_x, and condition_text_y, as well
% as the height of the figure and header.
figpos = get(obj.fig,'position');
pos = [grid.cells(i).condition_text_x figpos(4)-obj.header_height-grid.cells(i).condition_text_y grid.cells(i).condition_text_width grid.cells(i).condition_text_height];
if i == 1
pos(1) = pos(1);
pos(4) = grid.cells(i).height * grid.cells(i).condition_text_height;
pos(2) = pos(2)-pos(4)-grid.cells(i).condition_text_height-grid.cells(i).condition_text_offset;
pos(3) = grid.cells(i).width * grid.cells(i).condition_text_width;
pos(4) = grid.cells(i).height * grid.cells(i).condition_text_height;
else
prev_pos = grid.cells(i-1).get_pos;
pos(3) = grid.cells(i).width * grid.cells(i).condition_text_width;
pos(4) = grid.cells(i).height * grid.cells(i).condition_text_height;
pos(1) = pos(1);
pos(2) = prev_pos(2) - pos(4);
grid_color = grid.cells(i-1).color;
end
end
% if the edit box does not exist, ie. it is just being
% created or we are loading the figure
if (isempty(grid.cells(i).cond) || load == 1)
% create the new edit box
grid.cells(i).cond = obj.create_std_text(obj.fig,pos);
% if cell is the first in the grid use the new
% colour, else take the colour of the previous cell
% in the grid.
if(i==1)
set(grid.cells(i).cond,'BackgroundColor',grid_color);
else
set(grid.cells(i).cond,'BackgroundColor',get(grid.cells(i-1).cond,'BackgroundColor'))
end
grid.cells(i).color = grid_color;
% if we are loading the cell set the string of the
% edit box to be the value that we saved as a
% result of calling save_conditions
if (load == 1)
set(grid.cells(i).cond,'String',grid.cells(i).cond_text);
end
else
% if the edit box is already created change is
% position to newly determined position.
grid.cells(i).set_pos(pos);
end
% determine if we want to draw the new subgrid buttons,
% which is located to the right of each of the leaf
% cells.
if(grid.cells(i).pb_flag == 1 && obj.edit == 1)
pb_pos = pos;
pb_pos(1) = pos(1)+pos(3);
pb_pos(3) = grid.cells(i).grid_push_width;
if (ishghandle(grid.cells(i).grid_pb))
set(grid.cells(i).grid_pb,'Visible','on');
end
grid.cells(i).set_pb(obj.fig,pb_pos)
set(grid.cells(i).grid_pb,'UserData',obj);
elseif(grid.cells(i).pb_flag == 1 && obj.edit ~= 1)
if (ishghandle(grid.cells(i).grid_pb))
set(grid.cells(i).grid_pb,'Visible','off')
end
end
delete_pb_pos = [];
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
% detemine if we want to draw the new cell buttons,
% which are located at the botton of the set of cells.
if (i == size(grid.cells,2) && obj.edit == 1)
new_pb_pos = pos;
new_pb_pos(4) = grid.cells(i).condition_text_height/2;
new_pb_pos(3) = pos(3)/2;
new_pb_pos(2) = pos(2) - new_pb_pos(4);
if (ishghandle(grid.new_cell_pb))
set(grid.new_cell_pb,'Visible','on');
end
grid.set_pb(obj.fig,new_pb_pos);
set(grid.new_cell_pb,'userdata',obj);
delete_pb_pos = new_pb_pos;
delete_pb_pos(1) = new_pb_pos(1) + new_pb_pos(3);
if (ishghandle(grid.delete_cell_pb))
set(grid.delete_cell_pb,'Visible','on');
end
grid.set_delete_pb(obj.fig,delete_pb_pos);
set(grid.delete_cell_pb,'userdata',obj);
elseif (i == size(grid.cells,2) && obj.edit ~= 1)
if (ishghandle(grid.new_cell_pb))
set(grid.new_cell_pb,'Visible','off');
end
if (ishghandle(grid.delete_cell_pb))
set(grid.delete_cell_pb,'Visible','off');
end
end
% recursively draw the subgrid of the cell if it
% exists.
obj.draw_grid2(grid.cells(i).subgrid,load);
end
end
end
%% reset_wh
% function will call the set_widths and set_heights methods on
% the left grid in the table. The height and width values are
% used to draw the grid.
% inputs:
% obj:GUI - current GUI object
% outputs;
% none
function [] = reset_wh(obj)
width = obj.Grid2.max_width(1);
obj.Grid2.set_widths(width);
obj.Grid2.set_heights(obj.edit);
end
%% draw_grid1
% Draws the grid on the top onto the figure. the current
% assumption is that the top grid does not have any subgrids,
% inputs:
% obj:GUI - current GUI object
% grid:Grid - grid to be drawn, should be grid on top.
% load:boolean - 0 if grid is being refreshed, 1 if grid is being
% loaded for the firs time.
% outputs;
% none
function [] = draw_grid1(obj,grid,load)
% assumption grid 1 has no subgrids
pos = [];
for i=1:size(grid.cells,2)
% if we are in edit mode we need to shift over the cells to
% accomidate for the new grid buttons in the left grid.
if(obj.edit == 1)
pb_space = grid.cells(i).grid_push_width;
else
pb_space = 0;
end
figpos = get(obj.fig,'position');
% check if grid2 is empty, currently grid 2 will never be
% empty, may change in future though.
if (isempty(obj.Grid2))
pos = [grid.cells(i).condition_text_x grid.cells(i).condition_text_y grid.cells(i).condition_text_width grid.cells(i).condition_text_height];
else
pos = [grid.cells(i).condition_text_x+grid.cells(i).condition_text_width*obj.Grid2.max_width(1) figpos(4)-obj.header_height-grid.cells(i).condition_text_y-grid.cells(i).condition_text_height grid.cells(i).condition_text_width grid.cells(i).condition_text_height];
end
% set the x coordinate of the cell
pos(1) = pos(1) + (i-1)*grid.cells(i).condition_text_width + grid.cells(i).condition_text_offset + pb_space;
% if the edit box does not exist create it, if it does
% adjust it's position.
if (isempty(grid.cells(i).cond) || load == 1)
grid.cells(i).cond = obj.create_std_text(obj.fig,pos);
if (load == 1)
set(grid.cells(i).cond,'String',grid.cells(i).cond_text);
end
else
grid.cells(i).set_pos(pos);
end
end
% if we are in edit mode, draw the new and delete buttons at
% the right of the last cell
if( obj.edit == 1)
pos(1) = pos(1) + pos(3);
pos(2) = pos(2) + 20;
pos(4) = 20;
pos(3) = 60;
grid.set_pb(obj.fig,pos);
pos(2) = pos(2) - 20;
grid.set_delete_pb(obj.fig,pos);
set(grid.delete_cell_pb,'userdata',obj);
set(grid.new_cell_pb,'userdata',obj);
else
delete(grid.new_cell_pb)
grid.new_cell_pb = [];
delete(grid.delete_cell_pb)
grid.delete_cell_pb = [];
end
if obj.edit ==1 || load == 1
fig_pos = get(obj.fig,'position');
fig_pos(3) = pos(1)+pos(3);
set(obj.fig,'position',fig_pos);
elseif (pos(1) + pos(3)<obj.fig_width)
fig_pos(3) = obj.fig_width;
set(obj.fig,'position',fig_pos);
elseif (pos(1) + pos(3)<fig_pos(3) && pos(1) +pos(3) >obj.fig_width)
fig_pos(3) = pos(1)+pos(3);
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
set(obj.fig,'position',fig_pos);
end
end
end
%% draw_grid0
% function will draw the output grid onto the figure
% inputs:
% obj:GUI - current GUI object
% grid:Grid - grid to be drawn, should be grid on left.
% load:boolean - 0 if grid is being refreshed, 1 if grid is being
% loaded for the firs time.
% outputs;
% none
function [] = draw_grid0(obj,grid,load)
% ensure that the results grid is up to date.
grid.refresh();
for i=1:size(grid.Cells,2)
% get the x coordinate from the associated top grid cell,
% get the y coordinate from the associated right grid cell.
pos1 = grid.Cells(i).Cell1.get_pos;
pos2 = grid.Cells(i).Cell2.get_pos;
pos = [0 0 0 0];
pos(1) = pos1(1);
pos(2) = pos2(2);
pos(3) = pos1(3);
pos(4) = pos2(4);
if isempty(grid.Cells(i).result) || load == 1
grid.Cells(i).result = obj.create_std_text(obj.fig,pos);
% if we are loading the cell, try to restore the text
% that was saved using save_results.
if load == 1
set(grid.Cells(i).result,'String',grid.Cells(i).result_text);
end
else
set(grid.Cells(i).result,'position',pos);
end
end
end
%% draw_allgrids
% function will call the draw methods for each of the 3 grids.
% inputs:
% obj:GUI - current GUI object
% load:boolean - 0 if grid is being refreshed, 1 if grid is being
% loaded for the firs time.
% outputs;
% none
function [] = draw_allgrids(obj,load)
obj.draw_grid2(obj.Grid2,load);
obj.draw_grid1(obj.Grid1,load);
obj.draw_grid0(obj.Grid0,load);
end
%% evaluate_counter
function [] = evaluate_counter(obj,counter)
problem = obj.evaluate_counter_grid(obj.Grid2, counter);
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
if(~problem)
obj.evaluate_counter_grid(obj.Grid1, counter)
end
end
%% evaluate_counter_grid
% counter has form 'x=0\ny=2'
function problem = evaluate_counter_grid(obj,grid,counter)
% split the list of inputs to get inputs seperatly
inputs = get(obj.function_inputs_control,'String');
inputs = regexp(inputs,',','split');
check_string = [];
% keep track of the number of condtitions that evaulate to true
true_conds = 0;
sub_problem = 0;
problem = 0;
empty_cell = 0;
% initialize inputs to zero
% functions are assumed to be total, so 0 is just for
% convienence
for i=1:size(inputs,2)
% set to zero
%need to parse the types out of the inputs
inputi = regexp(char(inputs(i)),'\w*','match','once');
check_string = [check_string sprintf('%s=0;\n',char(inputi))];
end
check_string = [check_string counter sprintf('\n')];
for i=1:size(grid.cells,2)
condition_string = get(grid.cells(i).cond,'string');
if(~isempty(condition_string))
eval([check_string 'result =(' char(condition_string) ');'])
if(result == 0)
grid.cells(i).flag_cell(1);
else
true_conds = true_conds + 1;
grid.cells(i).flag_cell(2);
end
else
empty_cell = 1;
end
end
if (true_conds == 1)
for i=1:size(grid.cells,2)
condition_string = get(grid.cells(i).cond,'string');
if(~isempty(condition_string))
eval([check_string 'result =(' char(condition_string) ');'])
if(result == 0)
grid.cells(i).flag_cell(1);
else
if (~isempty(grid.cells(i).subgrid))
sub_problem = obj.evaluate_counter_grid(grid.cells(i).subgrid,counter);
end
grid.cells(i).flag_cell(2);
end
else
empty_cell = 1;
end
end
end
if (true_conds ~= 1 || sub_problem == 1)
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
end
end
%% create_std_text
% function will create an edit text box used for conditons and
% results. we want these to be consistent so its easier for it to
% be in one function.
% inputs:
% obj:GUI - current GUI object
% Parent:double - handle to parent figure
% position:[double double double double] - position to place edit
% box in.
% outputs;
% control:double - handle pointing to newly created uicontrol
function control = create_std_text(obj, Parent, position)
control = uicontrol('style','edit',...
'Parent',Parent,...
'units','pix',...
'position',position,...
'min',0,'max',1,... % This is the key to multiline edits.
'string',{''},...
'Max',2.0,...
'Clipping','on',...
'fontweight','bold',...
'BackgroundColor',[1 1 1],...
'horizontalalign','center',...
'fontsize',11);
end
%% clone
% creates copy of object
function copy = clone(obj,handle)
% assume that dialog is closed
copy = GUI(handle);
copy.function_name_text = get(handle,'Name');
copy.function_inputs_text = obj.function_inputs_text;
copy.Grid2 = Grid(2,[]);
copy.Grid1 = Grid(1,[]);
copy.Grid0 = RGrid(copy.Grid1,copy.Grid2);
copy.Grid1.set_rGrid(copy.Grid0);
copy.Grid2.set_rGrid(copy.Grid0);
obj.Grid2.clone(copy.Grid2,obj.Grid2.grid_index,[])
obj.Grid1.clone(copy.Grid1,obj.Grid1.grid_index,[])
obj.copy_results(copy)
end
function [] = copy_results(obj,dest)
for i=1:size(dest.Grid0.Cells,2)
for j=1:size(obj.Grid0.Cells,2)
if (strcmp(obj.Grid0.Cells(j).Cell1.cond_text,dest.Grid0.Cells(i).Cell1.cond_text) && strcmp(obj.Grid0.Cells(j).Cell2.cond_text,dest.Grid0.Cells(i).Cell2.cond_text))
dest.Grid0.Cells(i).result_text = obj.Grid0.Cells(j).result_text;
end
end
end
%%
function revised_input = parse_inputs(obj,input_string)
revised_input = [];
input_string2 = reshape(input_string',1,size(input_string,1)*size(input_string,2));
inputs = regexprep(input_string2,'\s','');
inputs = regexp(inputs,',','split');
% need to be careful here because pvs dependant types can have
% :'s in them
% find the first :, any thing before this is considered the
% variable any thing following is considered the type
c_locations = regexp(inputs,':','start');
sub_input{1} = inputs{i};
new_inputs{i} = sub_input;
sub_input{1} = inputs{i}(1:c_locations{i}(1)-1);
sub_input{2} = inputs{i}(c_locations{i}(1)+1:end);
new_inputs{i} = sub_input;
%new_inputs{i}(1) = inputs{i}(1:c_locations{i}(1))
%new_inputs{i}(2) = inputs{i}(c_locations{i}(1):end)
end
end
%inputs = regexp(inputs,':','split')
for i=1:size(new_inputs,2)
valid = regexp(new_inputs{i}(1),'[a-zA-Z][_a-zA-Z0-9]*','match');
new_inputs{i}(2) = {'error'};
%revised_input = cat(2,revised_input,[char(inputs{i}(1)); 'error'])
end
end
if isempty(revised_input)
revised_input = new_inputs;
end
end
function error = check_inputs(obj)
parsed_input = obj.parse_inputs(get(obj.function_inputs_control,'string'));
error = [];
for i=1:size(parsed_input,2)
if(size(parsed_input{i},2) == 2)
if (strcmp(parsed_input{i}(2),'error'))
error = [error sprintf('%s is not a valid variable name\n',char(parsed_input{i}(1))) ];
end
end
end
end
Colin Eles
committed
function [] = setPBenable(obj)
if size(obj.Grid1.cells,2) > 1
set(obj.Grid1.delete_cell_pb,'Enable','on');
else
set(obj.Grid1.delete_cell_pb,'Enable','off');
end
if size(obj.Grid2.cells,2) > 1
set(obj.Grid2.delete_cell_pb,'Enable','on');
else
set(obj.Grid2.delete_cell_pb,'Enable','off');
end
%set(obj.Grid2.delete_cell_pb,'Enable','off');
%set(obj.Grid1.delete_cell_pb,'Enable','off');
end