How do I plot a 3D mesh from multiple csv files?

5 ビュー (過去 30 日間)
Simon Mendum
Simon Mendum 2019 年 8 月 13 日
コメント済み: Jon 2019 年 8 月 13 日
How do I plot a 3D mesh from multiple csv files?
Here is the code I've been using, found from the internet:
nFiles=101
filenamePrefix='F1--Trace-no loop-0000--0000';
filenameExtension='.csv';
for i = 1:nFiles
filename = [filenamePrefix, int2str(i), filenameExtension];
tmpData=load(filename,'-ascii');
x{i}=tmpData(:,1);
y{i}=tmpData(:,2);
end
mesh(x{i},y{i},i}
This is the error I recieved:
Error using load
Number of columns on line 2 of ASCII file F1--Trace-no
loop-0000--00001.csv must be the same as previous lines.

採用された回答

Jon
Jon 2019 年 8 月 13 日
編集済み: Jon 2019 年 8 月 13 日
The problem apparently is with loading the files, nothing to do with plotting 3d mesh, or at least it didn't get far enough to have any problem with that. It is difficulat to tell exactly what is causing the problem without seeing the files you are trying to load.
I think that it is likely that the first line is a header and has a different number of columns
You could try
tmpData = readmatrix(filename, 'NumHeaderLines',1)
  11 件のコメント
Jon
Jon 2019 年 8 月 13 日
編集済み: Jon 2019 年 8 月 13 日
Glad to hear it is working for you. If this solved your problem, please accept the answer
Jon
Jon 2019 年 8 月 13 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalendar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by