imagesc graph axis setting probelm in Matlab Appdesigner

조회 수: 2 (최근 30일)
준홍
준홍 2024년 5월 21일
편집: VBBV 2024년 5월 24일
...
%% Loop start
numRows = length(shiftedDistance);
numCols = app.MaxMeasCountEditField.Value;
if isempty(app.dataMatrix)
app.dataMatrix = nan(numRows, numCols);
end
app.stop_loop = false;
if isempty(app.Ascan_cnt)
app.Ascan_cnt = 0;
end
while app.Ascan_cnt <= app.MaxMeasCountEditField.Value && app.stop_loop == false
% Add new data on the dataMatrix
if app.Ascan_cnt > numCols
% If I need to add cols
app.dataMatrix = [app.dataMatrix, nan(numRows, 1)];
numCols = numCols + 1;
end
app.dataMatrix(:, app.Ascan_cnt + 1) = newData;
% NaN to Zero
app.dataMatrix(isnan(app.dataMatrix)) = 0;
% image update
imagesc(app.UIAxes3_1, [1 app.Ascan_cnt], [min(shiftedDistance) max(shiftedDistance)], app.dataMatrix);
% xlim set
if app.Ascan_cnt > 50
xlim(app.UIAxes3_1, [app.Ascan_cnt - 49 app.Ascan_cnt]);
else
xlim(app.UIAxes3_1, [1 50]);
end
% ylim set
ylim(app.UIAxes3_1, [min(shiftedDistance) max(shiftedDistance)]);
colormap(app.UIAxes3_1, 'gray');
axis(app.UIAxes3_1, 'tight');
set(app.UIAxes3_1, 'YDir', 'reverse');
clim(app.UIAxes3_1, [0, app.ImageScalingEditField.Value]);
...
My code is like those.
I have a problem on setting the X axis in the Matlab appdesigner imagesc.
I want to add measured datas one by one on the defined Matrix.
And, I want the initial X axis with 50 components, and moving through when components are over 50s.
But, the datas add along arbitrary value even not integer.
what is my problem?
  댓글 수: 11
준홍
준홍 2024년 5월 22일
The caution message said that this kind of variables can't use dot indexing.
VBBV
VBBV 2024년 5월 23일
편집: VBBV 2024년 5월 23일

Ok. It may be for this reason, using sprintf function when you print to status text area value. This function prints output values in text or as character instead of numeric (double) values. Use without sprintf function as shown below

app.StatusTextArea.Value = app.Ascan_cnt

댓글을 달려면 로그인하십시오.

답변 (1개)

VBBV
VBBV 2024년 5월 23일
편집: VBBV 2024년 5월 24일
@준홍Ok. It may be for this reason, using *sprintf* function when you print to status text area value. This function prints output values in text or as character instead of numeric (double) values. Use without |sprintf| function as shown below
app.StatusTextArea.Value = app.Ascan_cnt

카테고리

Help CenterFile Exchange에서 Installation and Operational Settings에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by