yorkie_chris
20-08-09, 10:09 PM
clear
%clear the history
gridsize = menu ('what size matrix would you like?','10 by 10','40 by 40','80 by 80','custom size');
%ask user what size grid
if gridsize == 1
x=10;
y=10;
elseif gridsize == 2
x=40;
y=40;
elseif gridsize == 3
x=80;
y=80;
elseif gridsize == 4
%ask for custom size game
prompt={'Enter in the x dimension','Enter in the y dimension'};
%name of the query
name='Custom game size';
%lines
numlines=1;
%the default setting
defaultanswer={'20','20'};
%creates the box. input stored to matrix X
X=inputdlg(prompt,name,numlines,defaultanswer);
%split matrix X into seperate variables x and y to create grid with
end
x =X(1,1)
y =X(2,1)
select = menu ('Random starting condition or input .lif file?','Randomise','Load file');
if select == 1
A= randint(x,y);
elseif select == 2
[filename, pathname] = uigetfile('*.*', 'Pick any file')
end
Trying to form random binary matrix A.
Brings up the menus and stuff fine, works fine with the preset sizes 10x10 40x40 etc. BUT if you select a custom matrix size it throws up
??? Error using ==> randint at 60
Only numeric arguments are accepted.
Error in ==> GOL at 64
A= randint(X);
And it's starting to annoy. It will do this even if you set the custom size to the same as a preset one.
Checking on the main command menu shows that x and y are set to integers from the X matrix as they're supposed to be. What the b*ll*cky-f*** is wrong with it?
Gah!
%clear the history
gridsize = menu ('what size matrix would you like?','10 by 10','40 by 40','80 by 80','custom size');
%ask user what size grid
if gridsize == 1
x=10;
y=10;
elseif gridsize == 2
x=40;
y=40;
elseif gridsize == 3
x=80;
y=80;
elseif gridsize == 4
%ask for custom size game
prompt={'Enter in the x dimension','Enter in the y dimension'};
%name of the query
name='Custom game size';
%lines
numlines=1;
%the default setting
defaultanswer={'20','20'};
%creates the box. input stored to matrix X
X=inputdlg(prompt,name,numlines,defaultanswer);
%split matrix X into seperate variables x and y to create grid with
end
x =X(1,1)
y =X(2,1)
select = menu ('Random starting condition or input .lif file?','Randomise','Load file');
if select == 1
A= randint(x,y);
elseif select == 2
[filename, pathname] = uigetfile('*.*', 'Pick any file')
end
Trying to form random binary matrix A.
Brings up the menus and stuff fine, works fine with the preset sizes 10x10 40x40 etc. BUT if you select a custom matrix size it throws up
??? Error using ==> randint at 60
Only numeric arguments are accepted.
Error in ==> GOL at 64
A= randint(X);
And it's starting to annoy. It will do this even if you set the custom size to the same as a preset one.
Checking on the main command menu shows that x and y are set to integers from the X matrix as they're supposed to be. What the b*ll*cky-f*** is wrong with it?
Gah!