How can I link a .m file to a GUI with working variables?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone, I'm working on making a GUI for the one I need a script I did and have as an .m file, the thing is that I want the GUI to ask the user to write some parameters the one will be used by the .m file to make some calculus (using the ode45). I just started trying to make the variables that I have in the workspace to be saved in an .mat file (as I read in another question around here) so I can load this file into the .m file so it (the .m file) can work with the given variables, but I'm having troubles with the variables, this is what I have done so far:
>> save(variables.mat)
I added a button in the GUI in order that the user click on it and it contents the 'save' function as callback. I tried this code in the .m file to load the variables:
function dxdt = f(t,x)
load('variables.mat', 'p1 p2 p3 n')
dxdt = [ (p1 - x(2))*x(1) - ((p1)*(94)); %dG(t)/dt...
(There are more equations after that one) Should I write 'p1 p2 p3 n' in the "function dxdt = f(t,x)? [So it can recognize the variables "function dxdt = f(t, x p1, p2, p3, n)"] but this program is not loading the .mat file, how can I fix this? I need to work with the given parameters in the .m file.
Do you know a better way to work with all these variables in order to have so many buttons in the GUI?
Thanks so much!
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!