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 view (last 30 days)
Show older comments
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 Comment
Jan
on 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.
Answers (1)
Walter Roberson
on 8 Nov 2012
Was the GUI made with GUIDE? If so then
guihandle = CSinterface();
handles.list_materials = findobj(guihandle, 'tag', 'list_materials');
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps 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!