tough matlab problem help plz!
Hi everyone i am new here and i'd really appreciate it if someone could assist me with a matlab problem i have. Here goes:
I have an 100*176 array with each column containing data both categorical and numerical (a column can contain only one type of data though). What i need is a script to separate this array into every possible combination of arrays of 100*2 and 100*3 and for each of these smaller arrays to use their collumns as values in an anovan model (up to 3 way interactions, and sstype=3). To use matlab help as an example the anovan model will look something like this
anovan(MPG,{org cyl4 when},3,3,varnames)
where 'org' 'cyl4' and 'when' are the values derived from the collumns of one of the 100*3 smaller arrays and MPG is an 100*1 array that i have created beforehand and will be the same for all the combinations of values. I know the description of my problem isn't that clear but it's the best way i can describe it so if you have any questions about it please tell me so i can clear things up. Also if you could tell me how to write a script just to separate the bigger array into every possible combination of arrays of 100*2 and 100*3 that would be great help too!
I have an 100*176 array with each column containing data both categorical and numerical (a column can contain only one type of data though). What i need is a script to separate this array into every possible combination of arrays of 100*2 and 100*3 and for each of these smaller arrays to use their collumns as values in an anovan model (up to 3 way interactions, and sstype=3). To use matlab help as an example the anovan model will look something like this
anovan(MPG,{org cyl4 when},3,3,varnames)
where 'org' 'cyl4' and 'when' are the values derived from the collumns of one of the 100*3 smaller arrays and MPG is an 100*1 array that i have created beforehand and will be the same for all the combinations of values. I know the description of my problem isn't that clear but it's the best way i can describe it so if you have any questions about it please tell me so i can clear things up. Also if you could tell me how to write a script just to separate the bigger array into every possible combination of arrays of 100*2 and 100*3 that would be great help too!
0
Comments
thanks again!
*EDIT
I ended up with two scripts one for a matrix that has collumns containing only categorical data and one for collumns containing only numerical. Can you help me write a script that can work with a matrix having collumns of both kinds? I was wandering if it can be done with an if-else-end construction or if i have to use input() command giving information about which collumn is numerical.
thank you.
categorical data
for i=1:176 ><O:p></O:p>
for j=(i+1):176<O:p></O:p>
big=a(:,i);<O:p></O:p>
big=char(big);<O:p></O:p>
mak=a(:,j);<O:p></O:p>
mak=char(mak);<O:p></O:p>
anovan(total_adds,{big mak},'model','full','sstype',3)<O:p></O:p>
for k=(j+1):176<O:p></O:p>
lad=a(:,k)<O:p></O:p>
lad=char(lad)<O:p></O:p>
anovan(total_adds,{big mak lad},'model','full','sstype',3)<O:p></O:p>
end<O:p></O:p>
end<O:p></O:p>
numerical data
for i=1:176<O:p></O:p>
for j=(i+1):176<O:p></O:p>
big=a(:,i);<O:p></O:p>
big=cell2mat(big);<O:p></O:p>
mak=a(:,j);<O:p></O:p>
mak=cell2mat(mak);<O:p></O:p>
anovan(total_adds,{big mak},'continuous',[1 1],'model','full','sstype',3)<O:p></O:p>
for k=(j+1):176<O:p></O:p>
lad=a(:,k)<O:p></O:p>
lad=cell2mat(lad)<O:p></O:p>
anovan(total_adds,{big mak lad},'continuous',[1 1 1],'model','full','sstype',3)<O:p></O:p>
end<O:p></O:p>
end