while loop in file called by GUI pushbutton not working correctly
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I'm having trouble with a while loop used in a file which is run by a GUI.
The loop keeps going until a variable (v1) reaches a limiting value, while it calculates another variable (v2) for every step v1 takes. v2 is then used to calculate other variables (v3 etc.) which are then used in a simulink model to give the value for v1.
It runs fine in the file, and when I highlight and 'evaluate section' the reference to it in the GUI this also works.
However, when I run the GUI and attempt to run it through a pushbutton v1 keeps looping at the same value. v2,v3 etc. change as usual, but v1 stays constant.
I think this is probably a problem to do with the variables being saved to the workspace correctly. Otherwise I have no idea why running through the GUI means it doesn't just run the file as normal.
I'm extremely stuck and have been for some time, so any help would be brilliant
6 Kommentare
Jan
am 10 Jul. 2013
@Henry: Should I assume that "Initial_Parameters_2_1" is an M-script?
Do you see that there is no hibnt how your Simulink model gets its inputs and writes its outputs? Perhaps you inject the output to the base workspace. Without knowing this, it is impossible to guess, why the program does not work as you expect it to.
Such problems are y typical effect of the transport of variables by "poofing", this means using scripts instead of functions, evalin, assignin etc.
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!