import data from file into an array

8 visualizaciones (últimos 30 días)
Michael Whitsitt
Michael Whitsitt el 3 de Abr. de 2016
Editada: Star Strider el 3 de Abr. de 2016
how do I import data from a text file into an array with the same dimensions in the file?
the file has a 3 x 13 array in the form:
[1,2,3,4,5,6,7,8,9,10,11,12,13;
13,12,11,10,9,8,7,6,5,4,3,2,1;
1,1,1,1,1,1,1,1,1,1,1,1,1,1]
these are not the actual floating point numbers, but that is the layout of the file. how do I import or fscanf this into an array in a MATLAB program?
Thanks

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 3 de Abr. de 2016
Editada: Azzi Abdelmalek el 3 de Abr. de 2016
A=importdata('yourfile')
or
A=dlmread('yourfile')

Categorías

Más información sobre Workspace Variables and MAT Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by