imagesc graph axis setting probelm in Matlab Appdesigner
Afficher commentaires plus anciens
...
%% 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 commentaires
Angelo Yeo
le 21 Mai 2024
I need more information. I need your app and reproduction steps. I created a random app based on your description but I don't know what the issue is. Please take a look at my attachment and tell me how to reproduce your issue.

준홍
le 22 Mai 2024
Déplacé(e) : Angelo Yeo
le 22 Mai 2024
VBBV
le 22 Mai 2024
if app.Ascan_cnt > numCols
% 열을 추가해야 할 경우
app.dataMatrix = [app.dataMatrix, nan(numRows, 1)]; % numRows or numCols ?
numCols = numCols + 1;
end
준홍
le 22 Mai 2024
VBBV
le 22 Mai 2024
준홍
le 22 Mai 2024
준홍
le 22 Mai 2024
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
Réponses (1)
@준홍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
Catégories
En savoir plus sur Develop Apps Programmatically dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
