To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
TYRANISTAR
Banned
TYRANISTAR
5 Posts

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!
shwaip
elaborate bot
shwaip
5,729 Posts
this assumes your data is in a matrix called data
Code:
for ii=1:176
 for jj=(ii+1):176
  ind = [ii jj];
  anovan(MPG,data(:,ind),{whatever else goes here}); %this does 2d anova
  for kk=(jj+1):176
   ind = [ii jj kk];
   anovan(MPG,data(:,ind),{whatever else goes here}); %this does 3d anova
  end
 end
end
__________________ my photostream for ic photography challenge

Anyone who wants dropbox, please use my referral link
TYRANISTAR
Banned
TYRANISTAR
5 Posts
i am not really sure but doesn't that take only succesive collumns from the "data" matrix? e.g. ii=1 -->jj=2, ii=2 --> jj=3 etc? i need every possible combination between the collumns to work with. thanks a lot for your help though.. even so i have something to start working on... if you think something more please let me know.
thanks again!
shwaip
elaborate bot
shwaip
5,729 Posts
it tests all combinations.
TYRANISTAR
Banned
TYRANISTAR
5 Posts
i checked it out and you are right it's all the combinations. hehe i'm still very new at this. the anovan part has some problems but i think i can manage that on my own. (the values inserted in the anovan must be in the form of 176*1 char array). thanks a lot again! you've really been a great help!


*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 >>>
for j=(i+1):176>>
big=a(:,i);>>
big=char(big);>>
mak=a(:,j);>>
mak=char(mak);>>
anovan(total_adds,{big mak},'model','full','sstype',3)>>
for k=(j+1):176>>
lad=a(:,k)>>
lad=char(lad)>>
anovan(total_adds,{big mak lad},'model','full','sstype',3)>>
end>>
end>>





numerical data


for i=1:176>>
for j=(i+1):176>>
big=a(:,i);>>
big=cell2mat(big);>>
mak=a(:,j);>>
mak=cell2mat(mak);>>
anovan(total_adds,{big mak},'continuous',[1 1],'model','full','sstype',3)>>
for k=(j+1):176>>
lad=a(:,k)>>
lad=cell2mat(lad)>>
anovan(total_adds,{big mak lad},'continuous',[1 1 1],'model','full','sstype',3)>>
end>>
end
Similar Threads
Thread Thread Starter Forum Replies Last Post
MatLab problem - inline function zero finder PGolasze Matlab Help 4 10 May 2007 12:38am
Matlab problem - Power Series implementation skillz Matlab Help 15 27 Apr 2007 10:49pm
problem "error" in installing office 2007 plz help aljaare7 General Software 3 8 Apr 2007 10:28pm
XP Not Booting and Restarting (Possibly Hardware Problem) chanakber General Hardware 5 26 Mar 2007 3:07pm
A Problem With ATI's Drivers In DOOM 3? KingFish Technology Articles 2 31 Aug 2004 1:29pm

Go Back   Icrontic Forums > Tech: Software > General Software > Matlab Help
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 7:51am (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.