Cycle trough handles on GUI

3 views (last 30 days)
Lorenzo
Lorenzo on 6 Nov 2013
Commented: Lorenzo on 6 Nov 2013
Dear all, this is probably a stupid question and it was probably asked a thousand times before… Anyway… I have a GUI with a lot of tables. Every table's content is held by a handle called handle.table1, handle.table2 and so forth.
I would like to be able to change the content of the tables automatically with a for cycle.
So far I'm doing this: set(handle.table1, 'PropertyName', PropertyValue) set(handle.table3, 'PropertyName', PropertyValue) set(handle.table2, 'PropertyName', PropertyValue)
And I would like to do this:
for N=1:20
set(handle.tableN, 'PropertyName', PropertyValue)
end
But… how can I do it? I would like not to change the structure of the handle as that would be a messy solution since I have 4000 lines of code and would require a big rework of the whole GUI…
Thanks a lot!
Lorenzo

Accepted Answer

Lorenzo
Lorenzo on 6 Nov 2013
That's great, thanks! I guess I'll ty and use eval in order to do that… That's something I've already done in the past but I wasn't sure if I could do that with handles as well…
  2 Comments
Lorenzo
Lorenzo on 6 Nov 2013
I'm not setting the same thing for all of them. The first option you proposed (dynamic field) seems great! I'll test that!
Thanks for your help!

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 6 Nov 2013

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!