How can i use linkaxes with multiple imshow in appdesigner?

4 ビュー (過去 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 Center および File ExchangeDevelop 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