Sundeepan - I strongly suggest that you don't use eval to evaluate your expressions. Your
id = strcat('hPlot',num2str(l));
eval(sprintf('%s = PlottingGUI;',id));
seems to be dynamically creating local variables to the multiple instances of the PlottingGUI. But what happens to these variables afterwards? How do you reference them? A better solution would be to create an array of handles to the GUIs like
hPlottingGui = [];
for l = 1:num
hPlottingGui(l) = PlottingGUI;
end
With the above, you will still have all of the handles but they will be stored in an array and so easier to access/manipulate.
With your third piece of code, you state that In Main GUI, the plotting GUI is then called using the following code: which is
for figure_number = 1:num
GenID = strcat('Plot',num2str(figure_number));
GenGUI = getappdata(0,GenID);
g_main = findobj(GenGUI , 'type' , 'axes');
axes(g_main);
end
But the above iterates over ALL of your Plotting GUIs and not just a particular one. This implies that all of them will be updated. So how do you know when the Main GUI should update the Plotting GUI k?
Best Answer