How can I link a .m file to a GUI with working variables?
조회 수: 2 (최근 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에서 Whos에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!