Saving/Associating slider values with a pop-up menu

Following on from a question I posted yesterday about GUIs, I have another problem I've been working with. This question related to calculating the bending moment on a beam under different loading conditions.

On the GUI I have developed so far, I have a number of sliders (which now work properly) and a pop-up menu which defines the load case. I would like to be able to select the load case from the pop-up menu and position the loads as appropriate, in order to define each load case in turn. The output that I need is an array defining the load case number (the rows) and a number of loading parameters (the itensity and position of the loads, which are controlled by the sliders).

The problem I am having is that I can produce this array (of the size I need) and define the loading for one load case (by selecting the pop-up menu) using the sliders, but when I change the popup menu again, the array only keeps the loading for the load case selected by the pop-up menu.

Can anyone suggest an approach I can take with (specifically to store the variables from each load case) or an example that illustrates a similar solution to the problem?

The probem may be a bit vague, so please let me know if anything needs clearing up.

Many Thanks, James


You could use Application Data to store the current loading case and have a application data structure to store the values of each slider for the different loading cases.

In short, you could use the setappdata and getappdata to save and load the data you need. Mathworks has more information here.

Need Your Help