Style in Matlab functions
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
What style is preferred in function variables? E.g.:
figure('WindowState','maximized') vs. figure('windowstate','maximized') vs. figure('WindowState','Maximized'); or find(xxx,1,'first') vs. find(xxx,1,'First') etc.
All the above works, but is any version more robust towards future Matalb updates?
Thank you.
Stefan
1 comentario
Vilém Frynta
el 8 de Feb. de 2023
I don't think that this will change in future updates, however, I think you can't go wrong with the styles that are used in the official documentations.
figure('Name','Measured Data','NumberTitle','off');
set(groot,'DefaultFigureColormap','remove')
Theses examples look just like yours figure('WindowState','maximized').
Arguments have big letter at the end of each word and their values are lowercased (unless it's your own value like name).
However, I am not Mathworks employee and I do not have any information on this topic. This is something that just makes the most sense to me.
Respuestas (1)
Jan
el 8 de Feb. de 2023
I use the upper/lower case of the default setting:
h = figure;
set(h)
The documentation explains, that the names and values are not case-sensitive, so it can be expected to be compatible with future versions also. Matlab is very stable in such documented details.
Using the dot notation requires the correct case for the names:
h.WindowState = 'normal';
% Error:
h.windowstate = 'normal';
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!