How can i use linkaxes with multiple imshow in appdesigner?

조회 수: 3 (최근 30일)
Giulio Quaglia
Giulio Quaglia 2020년 12월 26일
답변: Benjamin Kraus 2020년 12월 27일
I wanna show all three layers of an RGB (or other color spaces) image and link them together with the original image to perform treshold operations with some spinner or slider. This is what i've tried so far:
properties (Access = private)
ax0 matlab.graphics.axis.Axes
ax1 matlab.graphics.axis.Axes
ax2 matlab.graphics.axis.Axes
ax3 matlab.graphics.axis.Axes
end
%reading image
[file,path]=uigetfile('*','Load');
filename=sprintf('%s%s',path,file);
filename = convertCharsToStrings(filename);
I = imread(filename);
%layers with max and min
I1=I(:,:,1); I1_down=min(min(I1)); I1_up=max(max(I1));
I2=I(:,:,2); I2_down=min(min(I2)); I2_up=max(max(I2));
I3=I(:,:,3); I3_down=min(min(I3)); I3_up=max(max(I3));
imshow(I,'Parent',app.UIAxes_tot); %original img
imshow(I1,[I1_down I1_up],'Parent',app.UIAxes_1); %1st layer
imshow(I2,[I2_down I2_up],'Parent',app.UIAxes_2); %2nd layer
imshow(I3,[I3_down I3_up],'Parent',app.UIAxes_3); %3rd layer
app.ax0 = axes(app.UIAxes_tot);
app.ax1 = axes(app.UIAxes_1);
app.ax2 = axes(app.UIAxes_2);
app.ax3 = axes(app.UIAxes_3);
linkaxes([app.ax0,app.ax1,app.ax2,app.ax3]);
this is the error:
Error using axes
Too many output arguments.
(line 56)
app.ax0 = axes(app.UIAxes_tot);
what is the problem?

채택된 답변

Benjamin Kraus
Benjamin Kraus 2020년 12월 27일
linkaxes only started working with UIAxes in MATLAB R2020b.
  • If you are using an older release and you cannot upgrade, I recommend switching from using UIAxes to regular axes. Regular axes have worked in App Designer since MATLAB R2018b, but you have to create them programmatically using the axes command (rather than dragging and dropping them when designing your app).
  • If you are using MATLAB R2020b, this code is unnecessary and is what is causing the problem:
app.ax0 = axes(app.UIAxes_tot);
app.ax1 = axes(app.UIAxes_1);
app.ax2 = axes(app.UIAxes_2);
app.ax3 = axes(app.UIAxes_3);
linkaxes([app.ax0,app.ax1,app.ax2,app.ax3]);
All you should need is this:
linkaxes([app.UIAxes_tot,app.UIAxes_1,app.UIAxes_2,app.UIAxes3]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by