Problem Plotting with Log Scale in GUI

2 visualizzazioni (ultimi 30 giorni)
Jared Kirsch
Jared Kirsch il 11 Giu 2018
Risposto: Rik il 11 Giu 2018
I have a GUI with axes. I can browse for a .mat file and then, with a button called "semilog plot", I want to plot the two variables contained in that .mat file on the axes. The problem is that when I click the button, the axes have the wrong scale and no curve appears. I can execute the same semilogy command in the command window and get a perfect plot, but for some reason, the command will not plot the data in the GUI axes. The only thing that I can think of besides there being a problem with the GUI recognizing the scale is that my dependent variable is a lowercase "i" and I get a warning as follows:
My code is as follows:
I greatly appreciate any help.

Risposta accettata

Rik
Rik il 11 Giu 2018
'poofing' variables into existence is not a good idea. If you load from a .mat file, at least use the struct output option. That way you (and others/future you looking at your code) can more easily understand where each variable is coming from.
The source of your problem might indeed be that Matlab treats the i in your command as the imaginary unit. (That might also be the content of the m-lint warning (the orange underlining).) That problem will be solved by using a struct.
S=load(CPI);
semilogy(S.v,S.i);

Più risposte (0)

Categorie

Scopri di più su Graphics Objects in Help Center e File Exchange

Prodotti


Release

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by