MATLAB: Workspace update

guiworkspace

for some time now I have been trying to automatically update the workspace, unfortunately without result.
THis is the case:
I use a GUI in which I have installed a few axes which plot a variety of data. there are also a few boxes which can be adjusted. These inputs ( the x and y coordinates of a circel on a plane) are then used to calculate the data used in the graphs. The calculations are done with several programmes. THe gui links to a driver file, which also links to a paramater file. THis parameter file is actually used to compute the coordinates. I use the command run to run all the programmes.
Now the problem is that I have to actually run the parameter file with the calculation in order to obtain the coordinates I specified earlier in the GUI, for some reason this doesnt seem to work without me having to run the programma manually. Is there anything I can do to do this automatically, so that when I click on plot, the gui alteres the graphs for the specific coordinates I specified in the boxes in the gui?
CHeers,
Casper

Best Answer

Then what should I ask, if everything I post is to vague... Gosh...
I doubt that you cannot watch the tinipic pictures I sent. Even when I am not logged in onto tinypic I can still view the pictures. Anyway, I will try to explain it again. THe pictures served as an illustration to make it easier for you to understand... Can I sent them to you by email if that is more covenient?
ALright, this is the case:
I am trying to simulate a car with a mass-demping system and pendulum installed on top of the car. This car ''rides'' on a 3D plane with mountains and valleys. THe task is to keep the upper part of the car horizontally while the car ''drives'' on top of the plane.
In order to simulate this I am using: * m-files * a simulink model * a GUI
The GUI shows one grpah with the plane, on the plane a circle is visible. THis is the route the car follows. In the GUI I want to be able to adjust the x and y coordinate and the radius of the circle. The GUI also shows three other graphs which plot the velocity, angle of the upper plate and the height of the car in respect to the XY plane. # # In the GUI.m I have specified the following inputs. When you press this button in the GUI itself, the graphs should automatically change to the x and y coordinates and the radius I specified in the GUI earlier.
% --- Executes on button press in edit_pushbutton.
function edit_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to edit_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
invoer.r = str2num(get(handles.edit_r, 'String'));
invoer.x_co = str2num(get(handles.edit_xco, 'String'));
invoer.y_co = str2num(get(handles.edit_yco, 'String'));
invoer.sn = str2num(get(handles.edit_sn, 'String'));
setappdata(0, 'invoer', invoer);
I then run my driver file:
%%Driver file runnen
run Driver_eind
%%get driver answers
uitvoer = getappdata(0, 'uitvoer');
and I plot my graphs.. This is actually the graph which plots the landscape, or the plane on which the ''car'' rides.
%%plotten landscape
axes(handles.axes_landscape)
cla
hold on;
plot3(x_route,y_route,z_route,'k','LineWidth',3);
surf(data);
xlabel('x-as [m]');
ylabel('y-as [m]');
This is another graph which plots dx = velocity and x= height
%%plotten
axes(handles.axes_snelheid)
cla
plot(resultaat.tout,resultaat.dx,resultaat.tout,resultaat.x);
legend('snelheid','afstand');
xlabel('t [s]')
ylabel('snelheid [m/s]')
title('snelheid/afstand wagen')
Oke, the GUI m file is slightly longer, with some more graphs plots being specified, but that is not the point.
The driver file is designed as follows, it first collects the x and y coordinate and the radius of the circle;
invoer = getappdata(0, 'invoer');
straal = invoer.r;
x_mid = invoer.x_co;
y_mid = invoer.y_co;
sn='invoer.sn';
it then runs the parameter file, in this file the new trajectories are beeing computed based on the x and y coordinate and the radius
%%Laad parameters
run Parameters_7;
%model parameter
teind =11;
additionally the simulink model is being opened and simulated, to compute the bahavior of the massa demping system and the pendulum.
%%simuleer
open('opdracht5.mdl')
sim('opdracht5');
alright, now the parameter file. as mentioned above, the x and y coordinates and radius are being used to determine the car its trajectory
x_route = x_mid- straal*cos([0:0.001:2*pi]);
y_route = y_mid - straal*sin([0:0.001:2*pi]);
z_route = interp2(ZI,x_route,y_route);
s(1) = 0;
for j=2:length(x_route)
s(j) = s(j-1) + sqrt((x_route(j)-x_route(j-1))^2+(y_route(j)-y_route(j-1))^2);
end
parameters.baan.x=s;
parameters.baan.y=z_route;
Right. And now the problem.... THe problem is that the GUI doesn't automatically alters the graphs when I have altered the x and y coordinates and radius. That is because the workspace isn't beeing updated, only when I first run the driver file, the workspace is being updated. When then the graphs are being plotted they are altered to the specified variables for x, y and the radius.