Info

This question is closed. Reopen it to edit or answer.

How to plot two functions from the attached file?

1 view (last 30 days)
Alexei Blednykh
Alexei Blednykh on 18 Nov 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
I would like to plot two functions from the same file. The row data are separated by text lines. I wold like to write a script in a way to plot those two functions using the matlab commands without editing the file manually. Thanks
Alexei

Answers (1)

Star Strider
Star Strider on 18 Nov 2014
This works:
fidi = fopen('Alexei Blednykh test.txt');
d1 = textscan(fidi, '%f %f', 'Delimiter','\n', 'CollectOutput',1);
fseek(fidi,0,0);
d2 = textscan(fidi, '%f %f', 'Delimiter','\n', 'HeaderLines',11, 'CollectOutput',1);
figure(1)
plot(d1{:}(:,1), d1{:}(:,2), d2{:}(:,1),d2{:}(:,2))
grid

Tags

Community Treasure Hunt

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

Start Hunting!