For Programmers: Free Programming Magazines  


Home > Archive > Matlab > October 2006 > Re: How to save and load variables in GUI applicat









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to save and load variables in GUI applicat
JWagberg

2006-10-31, 7:11 pm

Jason Wang wrote:[color=darkred]
> Thanks for reply. I figured it out. My purpose was to store some
> variables in a .mat file, and later extract them from it using load.
> All these are to be used in GUI coding.
>
> Here are the example codes:
> var1 = 5;
> var2 = 'Hello';
> save ('test.mat', 'var1', 'var2');
>
> Now extract the variables from the file:
> S = load('test.mat');
> S.var1
> S.var2
>
> Once I found out I can load the variable into a structure S, then the
> question is solved.
>
> Jason
>
> Garrett wrote:

Assuming you have saved your variables in some UserData,
ApplicationData or inside nested functions, you can just save the whole
GUI as a .fig file and have Matlab automagically restore them when the
GUI is reloaded.
..
/jewa

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com