Create plot (fig file) from text file

조회 수: 2 (최근 30일)
Steen
Steen 2023년 1월 19일
댓글: Steen 2023년 1월 31일
I am using the below code to import data from text file. The code is working, but the .Fig file are very slow afterwards
Is the code ok, or is there a better way
datafile = 'Test_1_pre_test_with_Prose_Fan_Load_streng_1_error_at_8_procent_115222_230119_TEST_1.txt';
T = readtable(datafile,'Format','auto');
T1 =T;
hold on
t = T1.TIME;
P = T1.Properties.VariableNames(2:end);
for K = 1 : length(P)
fn = P{K};
plot(t, T1.(fn), 'DisplayName', fn);
end
hold off
set(gcf, 'visible', 'on')
legend show

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 19일
T = readtable(datafile,'Format','auto');
P = string(T.Properties.VariableNames) ;
plot(T, P(1), P(2:end)) ;
legend show
  댓글 수: 7
Steen
Steen 2023년 1월 31일
I might be because of file size. If I make a shorter file, I can save it. But I cant change the file size og why can do you think I can save the file, when using the below code
datafile = 'Test_1_pre_test_with_Prose_Fan_Load_streng_1_error_at_8_procent_115222_230119_TEST_1.txt';
T = readtable(datafile,'Format','auto');
T1 =T;
hold on
t = T1.TIME;
P = T1.Properties.VariableNames(2:end);
for K = 1 : length(P)
fn = P{K};
plot(t, T1.(fn), 'DisplayName', fn);
end
hold off
set(gcf, 'visible', 'on')
legend show

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

카테고리

Help CenterFile Exchange에서 Measurements and Statistics에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by