Convert CSV to cell array

64 Ansichten (letzte 30 Tage)
chris j
chris j am 2 Jan. 2018
Beantwortet: Gaurav Ahuja am 5 Jan. 2018
I've tried searching for solutions to this, but can't seem to find one that works for my file format. I have a .CSV file output from some other software, and want to analyse the data in Matlab. The output (attached 2 examples) consists of a row of amplitudes, a row of standard deviations (the length of which varies by data set), and then a row of fit diagnostics. Following that is a table with additional information.
Is there a way to directly convert this CSV into a cell array? I'm sure I could write something to stucture the data once it's in a cell array, but using things like textscan etc has been giving me a headache...

Antworten (1)

Gaurav Ahuja
Gaurav Ahuja am 5 Jan. 2018
use this syntax
if true
[num,txt,raw] = xlsread(___)
end
returns the text fields in cell array txt, and both numeric and text data in cell array raw, using any of the input arguments in the previous syntaxes.
refer this documentation link for example: https://in.mathworks.com/help/matlab/ref/xlsread.html#bthgbmn
Hope this helps.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by