[TOC]

csvread

Reading an array from a CSV file

Usages

csvread(path)

csvread(path, r1, c1)

csvread(path, r1, c1, [r1 c1 r2 c2])

Examples

Input
a = rand(3,4)
path = './../csv/data/a.csv';
csvwrite(path,a);
b = csvread(path)
Output
a = 1e-1 ×
 8.452   9.059   6.624   8.596
 9.679   8.034   0.183   6.887
 0.980   7.559   6.545   7.754

Array written to debug/csv/data/a.csv successfully.

Array read from debug/csv/data/a.csv successfully.

b = 1e-1 ×
 8.452   9.059   6.624   8.596
 9.679   8.034   0.183   6.887
 0.980   7.559   6.545   7.754
Input
a=rand(3,4)
path='./../csv/data/a.csv';
csvwrite(path,a);
b=csvread(path,2,1)
Output
a = 1e-1 ×
 7.477   4.001   0.084   3.789
 0.297   8.877   6.255   7.504
 1.033   0.067   5.767   1.423

Array written to debug/csv/data/a.csv successfully.

Array read from debug/csv/data/a.csv successfully.

b = 1e-1 ×
 0.067   5.767   1.423
Input
% Input
a=rand(3,4)
path='./../csv/data/a.csv';
csvwrite(path,a);
b=csvread(path,2,1,[2 1 2 2])
Output
% Output
a = 1e-1 ×
 4.496   3.148   9.530   0.040
 4.412   8.323   5.474   3.422
 0.176   3.053   3.370   0.978

Array written to debug/csv/data/a.csv successfully.

Array read from debug/csv/data/a.csv successfully.

b = 1e-1 ×
 3.053   3.370