vendredi 15 mai 2015

Matlab: using a string as condition for if statement

cond = 'a=1';
a=1;
if (cond)
b=0;
end

Hi! Is there a way to do the thing I wrote above? In a text variable I need to write a condition (even a complex one, using && and || too) and then in the IF statement I simply insert the variable. I tried this example but sadly it didn't work. Can you solve it?

Aucun commentaire:

Enregistrer un commentaire