Azzera filtri
Azzera filtri

Writing Code for function with CSV and character array

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Walter Roberson
Walter Roberson il 14 Nov 2019
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.

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by