Plot multiple axis in GUI (2 y-axis and 1 x-axis)
Afficher commentaires plus anciens
I am having difficulties trying to plot 3 lines in one axes with two y-axis. I import an Excel file with 4 columns:
G=xlsread*'Test1.xlsx','Sheet1','A3:D18'); %loading the Excel file
F = G(:,1); %these values represent the x-axis
S = G(:,2); %these values are for y-axis 1
L = G(:,3); %these values are for y-axis 1
D = G(:,4); %these values are for y-axis 2
I found this link to plot multiple axis into a GUI, but it does not even work in Matlab r2014b: http://www.mathworks.com/matlabcentral/answers/100583-how-do-i-create-multiple-axis-objects-in-a-gui-using-matlab-7-7-r2008b
Maybe anyone can help me with this.
Réponses (1)
dpb
le 23 Déc 2014
2 votes
The key is in the error message "Conversion to double from cell..." combined with the subject line of multiple axes and the comment on the line in question _"%assumes the axis inside the GUI is the only axis".
Says ax1 is a cell (or perhaps a cell array if the assumption of only a single axes as noted in the comment isn't true).
If it is only one element returned, then use
ax1 = cell2mat(findall(0, 'type', 'axes'));
to convert to the double.
If there are more than the one axes objects, then you've got more work to do to find the one of interest, specifically.
3 commentaires
dpb
le 4 Oct 2019
I don't do GUIs but it's unclear to me why yyaxis wouldn't work there just as well as not...
The typical problem in GUIs is ensuring access to the necessary data in the callback functions.
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!