Writing Code for function with CSV and character array
조회 수: 1 (최근 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에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!