I’m a beginner in MATLAB and hope someone can help me with this problem.
The GUI I created produce ‘G’ corresponding to user’s frequency and amplitude inputs. For ex. freq=[2 3 7]; AMPL=[2 3 4], the G produced is
7.8214 5.0132 1.7297
6.8302 4.3406 1.4855
6.3412 4.0536 1.3403
As a second ex. if user inputs,freq=[2 3] and AMPL=[3 4]; the G produced is
[6.9020 4.3621;
6.2893 4.0276]
Thus G can be of any size depending on the no. of freq and AMPL input. Min. size of G is [1 1] ie a single number and max. size it can be of [6 6];
what I want to do is to intoduce a pushbutton(save_G) in my GUI,which will save the G generated in another variable(lets say G5). thus once a user input a specific freq and AMPL and generate G, that G should save on G5 once the user enter save_G pushbutton. and again if the user inputs other values for freq and AMPL and generated a new G,this new G should add on to the G5(if user presses the save_G5 button).How do I store the old G value and append the new G value to the G5 on hitting the pushbutton? thus I want my G5 should look like as follows for the above examples.
G5=
freq(1)=[2 3 7]; AMPL(1)=[2 3 4];
G(1)=
7.8214 5.0132 1.7297
6.8302 4.3406 1.4855
6.3412 4.0536 1.3403
freq(2)=[2 3] ;AMPL(2)=[3 4];
G(2)=
6.9020 4.3621
6.2893 4.0276
Thus G5 should keep on saving Gs and have to be sorted in the ascending order of the first element of frequencies.
How can I achieve this? Looking forward for someone’s help. assistance will be highly appreciated.
As far as I undersand your point, I think you should use a cell.
At the beginning of the program you initialize
G5to en empty cell:and each time the user press a button, you should append the new G to G5:
for more information about cells, if you are a beginner:
http://www.mathworks.fr/help/techdoc/matlab_prog/br04bw6-98.html#br04bw6-117