Hello All, My girlfriend has asked me to give her a hand with some Matlab, and I am afraid my programming days are long gone/my mind has gone blank. This ought to be a really simple loop/if statement - basically the experiment she wants to run has two possible conditions, and she has the script for these two conditions - so she would like (for example) to run condition A 5 times, followed by B 5 times, followed by A 5 times, etc. So how do I get the following to work (as I don't think MATLAB goes through each entry of a matrix). exp = [A A A A A B B B B B A A A A A] if exp = A ...code code code code... else if exp = B ...code code code code code... Does that make sense? Is this possible without "breaking" the program up into seperate .m files? Thanks for any help/thoughts/STFU N00b!
for i=1:len(exp) if exp == A blah else if exp ==B blah#2 Although as far as my memory goes I think matlab has python-like iteration over array elements
Thanks Valo for the really fast reply! What do you mean by "pytho like iteration over array elements"?