adam mcbrinn
adam mcbrinn

Reputation: 17

Matlab: read csv into array

im new to matlab and coding. I have a csv file with data that goes like:

3 2 91 83 17

3 2 86 84 4

3 2 90 83 162

(there's a total of 7000 rows)

I need a way to read this into an array, can the array be something like A[I,J,K,L,M] with age=I for example? How would i go about doing this?

Upvotes: 0

Views: 2537

Answers (2)

Raj
Raj

Reputation: 138

dlmread(), csvread(), and xlsread() all work well.

Note that the first two (dlmread and csvread) are for numeric data only, and xlsread is limited by what excel can process (which in my experience is capped at somewhere around 1 million rows). xlsread can get you text and raw as well.

Upvotes: 0

Kostya
Kostya

Reputation: 1572

M = csvread(filename);
age = M(:,1); Doa = M(:,2); los = M(:,3); gender = M(:,4); dest = M(:,5);

Upvotes: 1

Related Questions