|
"Chanpreet " <c.kaur@tue.nl> wrote in message <i3oura$klh$1@fred.mathworks.com>...
> dear all
>
> I am new to matlab gui.
> I have a question. please help me with your suggestions.
> I want to save the option selected from pop up menu and want to use it in some other .m file.
> I have used save and load comand it is also not working.
> my problem looks like this
> str = get(hObject,
> 'String');
> val = get(hObject,
> 'Value');
> % Set current data to the selected data set.
> switch str{val};
> case 'Inner_points'
> con = 1;
> case 'Inner_radius' % User selects Membrane.
> con = 2;
> case 'Inner_points_and_radius' % User selects Membrane.
> con=3;
> case 'Outer_points' % User selects Membrane.
> con=4;
> case 'Outer_radius' % User selects Membrane.
> con=5;
> case 'Outer_points_and_radius' % User selects Membrane.
> con=6;
> case 'Both_inner_and_outer_shape' % User selects Membrane.
> con=7;
> end
> guidata(hObject, handles);
> % save -mat con.m con
> % load -mat con.m con
> I want to save the con.
> if you can help me with this question or if you can tell me some other option, it would be very helpful for me.
> thanks in advance for looking at my problem
Hey,
I suggest you not to save this info but to get it directly from your other m-file, the one that is currently loading the info. That way, no new file are created, so it's a step less to do.
To do that, you'll have to have the handle of your popupmenu. If the "other m-file" is the callback function of the popupmenu, you can use gco, but if it isn't, you'll have to save your handles at the end of your main fonction. To do that, I suggest you to use a combinaison of guihandles and guidata, which are working fine for me.
Good luck!
Fred
|