views:

83

answers:

2

How can I load a matrix data file into Matlab?

The file contains numeric data as well as strings. One line in the file corresponds to one measurement; data on the same line is separated by commas.

+2  A: 

Notre site semble d'avoir deja une question de cette sorte.

Matrix from Python to MATLAB

Regarde-la, stp, peut-etre ca te donnera des idees.

Developer Art
Matlab est bien de la programmation, c’est donc le bon site pour ce genre de questions.
Konrad Rudolph
+1  A: 

--- english below ----

C'est un peu plus facile si tu donnes un example du fichier que tu veux lire. En tout cas, textread pourrait etre la fonction que tu veux utiliser.

Si ton fichier s'appelle mydata.txt et s'il contient first,4.2 second,22

tu utilises

[strings,numbers] = textread('mydata.txt','%s %f','Delimiter',',');

It helps if you give an example of what your text file looks like. Most likely, textread is what you're looking for.

If your file is called mydata.txt and contains first,4.2 second,22

you can read it with

[strings,numbers] = textread('mydata.txt','%s %f','Delimiter',',');
Jonas