how to change the value of a gui object using an external function (i.e without using the m file associated with the gui)?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello there,
The question is quite self-explanatory so i'll just add an example to make it clearer:
function [csnames] = editcs (value)
global CSPROPS
CSinterface(); *%%this initiates the GUI*
global matprops
% reset materials
matnames = cell(length(CSPROPS(value).matprops),1);
for m = 1:length(CSPROPS(value).matprops)
matnames(m) = {CSPROPS(value).matprops(m).name};
end
set(handles.list_materials,'String',matnames);
%%here is where i am getting my error, which i find is probably due to any syntax error when calling out what handles.list_materials refers to.
Would really appreciate if anyone could give me an insight on this.
PN.
1 Kommentar
Jan
am 8 Nov. 2012
No, the question is definitively not self-explanatory. You assume a syntax error, but you do not mention the occurring error message or MLint warning. If there is no such message, why do you think, that it is probably a syntax error?
Btw.: This is more efficient:
matnames{m} = CSPROPS(value).matprops(m).name;
By this way Matlab does not have to create a cell array on the right hand side at first, but can insert the value directly in the existing cell on teh left hand side.
Antworten (1)
Walter Roberson
am 8 Nov. 2012
Was the GUI made with GUIDE? If so then
guihandle = CSinterface();
handles.list_materials = findobj(guihandle, 'tag', 'list_materials');
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!