Writing Code for function with CSV and character array
3 ビュー (過去 30 日間)
古いコメントを表示
How do you code for a function that returns a character array associated with a column from a character array in comma-separated values (CSV) format.
0 件のコメント
回答 (1 件)
Walter Roberson
2019 年 11 月 14 日
If the column number to extract is C then
fmt = [repmat('%*s', 1, C-1), '%s', '%*[^\n]']
Now you can use that with textscan with Delimiter set to comma. You will need to convert the cell array that results into a character array.
There are other approaches including using readtable, especially after using detectImportOptions and setting the returned variables option to just the column you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!