How to import data from .txt file?
347 ビュー (過去 30 日間)
古いコメントを表示
Benjamin Watson
2016 年 4 月 13 日
コメント済み: Jan Babiuch-Hall
2022 年 5 月 3 日
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 件のコメント
採用された回答
Azzi Abdelmalek
2016 年 4 月 13 日
編集済み: Azzi Abdelmalek
2016 年 4 月 13 日
Spill1 = importdata('Spill.txt');
Spill=Spill1.data
T = Spill(:,1);
C = Spill(:,2);
plot(T,C)
xlabel('Time / Days');
ylabel('Concentration / ppb')
0 件のコメント
その他の回答 (2 件)
parham kianian
2020 年 9 月 2 日
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:
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!