Plot multiple axis in GUI (2 y-axis and 1 x-axis)
이전 댓글 표시
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.
답변 (1개)
dpb
2014년 12월 23일
2 개 추천
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
dpb
2019년 10월 4일
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.
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!