필터 지우기
필터 지우기

How can I get a plot legend to give a different value for every input file?

조회 수: 1 (최근 30일)
JJH
JJH 2018년 11월 7일
답변: madhan ravi 2018년 11월 7일
I have a code that plots some data:
D = 'My Directory';
S = dir(fullfile(D,'LIV Data T= *.mat')); % Makes a structure with all files
N = numel(S); % Counts number of files
for ii = 1:N
T = load(fullfile(D,S(ii).name)); % Load each file as a structure
I = T.num(3:end,1); % Extract each parameter from full file and ignore first two data points
V = T.num(3:end,2);
P = T.num(3:end,3);
figure(1);
plot(I,P,'-o','markers',3)
xlabel('Current (mA)')
ylabel('Power (mW)')
hold on
figure(2);
plot(I,V,'-o','markers',3)
xlabel('Current (mA)')
ylabel('Voltage (V)')
hold on
end
I am trying to create a plot legend for each data file saying T=10 for the first, T=15 for the second, etc. such that the plot has a full legend shown for each line. How do I go about this?

답변 (1개)

madhan ravi
madhan ravi 2018년 11월 7일

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by