Notepad .txt to Matlab

3 vues (au cours des 30 derniers jours)
Martín Menéndez
Martín Menéndez le 16 Avr 2017
I have this .text in notepad:
data _ electrical _ material_Graphic
x y
0 0,00
10 0,05
20 0,13
23 0,15
25 0,17
And I need to create an Matrix with only two columns with the values of x and y. I try with "importdata", but this command created me only one column. *Another problem is to change the commas by points
Thaks for you answer
  1 commentaire
Stephen23
Stephen23 le 16 Avr 2017
Modifié(e) : Stephen23 le 16 Avr 2017
Search this forum for "decimal comma" and you will find many solutions, discussions, and ideas:
I used the big "Search Answers" field in the top right-hand corner of this page. That "Search" feature lets me and you search this forum for answers. It is easy to use: just write some relevant terms in the box and click the magnifying glass button. You can also search this forum using your favorite internet search engine.

Connectez-vous pour commenter.

Réponse acceptée

Star Strider
Star Strider le 16 Avr 2017
MATLAB is not going to recognise the comma decimal separator. One approach is in troubles to load .txt-file in matlab (link).
Change the format specifier in the textscan call to:
dscc = textscan(fidi, '%f%s', 'Delimiter',' ', 'CollectOutput',1);
or whatever works for your file. Experiment to get the result you want.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by