error using textscan with csv files

2 ビュー (過去 30 日間)
C.G.
C.G. 2022 年 2 月 16 日
回答済み: Walter Roberson 2022 年 2 月 16 日
I have been given a code to process some data in a csv file. When I run this I get the error below. Can anybody help?
fid = fopen('time.csv');
out = textscan(fid,'%s %f %f %s','delimiter',',','headerlines',1);
fclose(fid);
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 2 月 16 日
The fopen failed. The file does not exist in the matlab path, or you do not have permission. if you used the two-output form of fopen you would get a message about why it failed.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by