A problem I have using the subplot command

1 Ansicht (letzte 30 Tage)
Fan Yang
Fan Yang am 12 Mär. 2020
Beantwortet: Walter Roberson am 12 Mär. 2020
When I run the script, I expect one of the outpots to be a 8 by 3 subplot.
However, one of the plots in the subplot is missing.
When I simply tried to plot the data from the missing plot, it worked out just fine.
% calling all data into a cell array
clear all; close all; clc;
DATA = {}; K = {}
TTID = 1:8; TLID = 1:3
count = 0;
for i = 1:numel(TTID);
for j = 1:numel(TLID);
fname = sprintf('%s%i_%s%i.%s','TT',TTID(i),'TL',TLID(j),'txt')
T = textread(fname);
T = T(:,[1,2]);
T(:,2) = T(:,2) / (pi*0.15^2);
DATA{i,j} = T;
plot(T(:,1),T(:,2))
title(fname);
count = count + 1
subplot(8,3,count)
end
end
  1 Kommentar
Walter Roberson
Walter Roberson am 12 Mär. 2020
Please post your code. I can think of a few different ways this could happen.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Mär. 2020
% calling all data into a cell array
clear all; close all; clc;
DATA = {}; K = {}
TTID = 1:8; TLID = 1:3
count = 0;
for i = 1:numel(TTID);
for j = 1:numel(TLID);
fname = sprintf('%s%i_%s%i.%s','TT',TTID(i),'TL',TLID(j),'txt')
T = textread(fname);
T = T(:,[1,2]);
T(:,2) = T(:,2) / (pi*0.15^2);
DATA{i,j} = T;
count = count + 1
subplot(8,3,count)
plot(T(:,1),T(:,2))
title(fname);
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by