How to import data from .txt file?
392 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Benjamin Watson
am 13 Apr. 2016
Kommentiert: Jan Babiuch-Hall
am 3 Mai 2022
Hi All,
Ive tried importing my data via this code;
Spill = importdata('Spill.txt');
T = Spill(:,1);
C = Spill(:,2);
plot(T,C)
xlabel('Time / Days');
ylabel('Concentration / ppb')
but it doesn't work as it says "Index exceeds matrix dimensions.". It needs to be inputted by code and not just the import button. Can someone help? Ive attached the .txt file
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 13 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 13 Apr. 2016
Spill1 = importdata('Spill.txt');
Spill=Spill1.data
T = Spill(:,1);
C = Spill(:,2);
plot(T,C)
xlabel('Time / Days');
ylabel('Concentration / ppb')
0 Kommentare
Weitere Antworten (2)
parham kianian
am 2 Sep. 2020
I think it is much easier to use textread function. Following link describe in full detail how to use this function to import data from a text file:
1 Kommentar
Siehe auch
Kategorien
Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!