I have just installed Matlab R2015a with the new object-oriented syntax to get/set graphic object properties e.g.:
h_quit.Enable = 'On'
instead of:
set(h_quit,'enable','on')
Very good. But is there a "with" function similar to the one in VBA, that could allow us in some cases to save characters in program ? That way, we could write:
With data.UsedByGuiData_m .TagPanel(2).Visible = 'off' .TagPanel(3).Visible = 'off' .TagPanel(4).Visible = 'off' .TagPanel(5).Visible = 'off' endwith
instead of:
data.UsedByGuiData_m.TagPanel(2).Visible = 'off';data.UsedByGuiData_m.TagPanel(3).Visible = 'off';data.UsedByGuiData_m.TagPanel(4).Visible = 'off';data.UsedByGuiData_m.TagPanel(5).Visible = 'off';
Another question related to this new syntax:
to retrieve the resolution of my computer screen, I use:
get(0,'ScreenSize')
I have tried the new syntax:
0.ScreenSize
But it doesn't work, I get the following error message:
Parse error at ScreenSize: usage might be invalid Matlab syntax.
Is it normal ?
Best Answer