Error when plot loaded .mat file in app designer
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Aron Horvath
il 2 Lug 2021
Commentato: Aron Horvath
il 2 Lug 2021
Hi !
I'm trying to plot data got from a .mat file but the following error pops up:
Error using plot
Unrecognized property x for class Line.
Error in app1/draw (line 25)
plot(app.UIAxes, t,x_grad(:,1))
Here are the code what I use:
I save the variables in two separate files
save('w_gradiens_lotka','w')
save('x_gradiens_lotka','x')
where x is a 61x2 matrix and w 61x1 vector
Then I load the two files and plot:
t=0:0.05:12;
w_grad = load('w_gradiens_lotka.mat','w');
x_grad = load('x_gradiens_lotka.mat','x');
%I have three charts:
drawnow
plot(app.UIAxes, t,x_grad(:,1))
drawnow
plot(app.UIAxes2, t,x_grad(:,2))
drawnow
plot(app.UIAxes3, t,w_grad)
drawnow
I dont know what did I miss here ...
Thank you for your help !
0 Commenti
Risposta accettata
Geoff Hayes
il 2 Lug 2021
Aron - I suggest you use the MATLAB debugger to step through the code and see what the variables
w_grad = load('w_gradiens_lotka.mat','w');
x_grad = load('x_gradiens_lotka.mat','x');
look like. I suspect that both are structures and that x_grad might have a field named x. In which case, your code would need to look like
plot(app.UIAxes, t,x_grad.x(:,1))
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!