How to add Labels to Files saving as .txt
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi All,
I was trying to add labels to my columns of the files I'm saving as .txt. The files are the loadPhase and loadRelax I'm trying to add the column labels too. I tried to do x.properties.variables and that didn't work. I'm lost on any other ideas of how to add labels to the columns. My code is below. Any help would be appreciated! Thank you in advance! :)
load('experiment1.txt','-ascii')
%when you remove the % in the code it presents with an error this is because the % made it so matlab could read it.
Time=experiment1(:,1);
Load=experiment1(:,2);
Displacement=experiment1(:,3);
subplot(4,1,1);
plot(Displacement,Time)
xlabel('Time (seconds)')
ylabel('Displacement (Meters)')
title('Displacement vs Time')
subplot(4,1,2);
plot(Load,Time)
xlabel('Time (seconds)')
ylabel('Load (Joules)')
title('Load vs Time')
[M,I]=max(Load);
timep=(Time(1:1827));
timer=(Time(1828:9504));
loadp=(Load(1:1827));
loadr=(Load(1828:9504));
loadPhase=[timep,loadp];
loadRelax=[timer,loadr];
subplot(4,1,3)
plot(timep,loadp)
xlabel('Time (seconds)')
ylabel('Loading (Joules)')
title('Load vs Time for the Loading Phase')
save
subplot(4,1,4)
plot(timer,loadr)
xlabel('Time (seconds)')
ylabel('Loading (Joules)')
title('Load vs Time for the Relaxing Phase')
save('loaddata.txt','loadPhase','-ascii')
save('relaxdata.txt','loadRelax','-ascii')
0 Kommentare
Antworten (1)
Star Strider
am 24 Jan. 2021
Create the columns as a table, then add the column names as variable names. Use writetable to save it as a file.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Polar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!