use of eval in loop, Index exceeds matrix dimensions.

1 Ansicht (letzte 30 Tage)
Michiel Adams
Michiel Adams am 6 Jun. 2012
Hi,
I have 250 decision trees in a dataset called c1 .. c250
I am trying to use the isbranch function in a loop.
This is the code:
for i = 1:250
STR = sprintf('isbranch(c%d)',i);
branches = eval(STR);
end;
I used eval before to use these trees, and no error was showing then. Now I keep getting the error:
Index exceeds matrix dimensions.
Any suggestions would be welcome.
Thanks,
Michiel
  4 Kommentare
per isakson
per isakson am 6 Jun. 2012
Are "c1 .. c250" objects of the class, classregtree?
per isakson
per isakson am 7 Jun. 2012
How does the full error message read?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by