WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Importing a .csv file

 

2menace
Forum-Newbie

Forum-Newbie


Beiträge: 2
Anmeldedatum: 14.05.13
Wohnort: Schweiz
Version: ---
     Beitrag Verfasst am: 14.05.2013, 09:05     Titel: Importing a .csv file
  Antworten mit Zitat      
Hi there, I'd like to import a .csv file that looks like this:

"1890","76763.0731265183"
"1889","76884.4734023754"

when I import it with matlab it only shows as 1 value over the entire length of the line.
I'd like to only have the numbers in a ix2 matrix where the " are ignored and the , count as a delimiter and the . serves as the decimal point

can anybody help me out?
I've been searching all over and couldn't find anything helpfull

Thank you in advance!
Private Nachricht senden Benutzer-Profile anzeigen


Andreas Goser
Forum-Meister

Forum-Meister


Beiträge: 3.654
Anmeldedatum: 04.12.08
Wohnort: Ismaning
Version: 1.0
     Beitrag Verfasst am: 14.05.2013, 09:15     Titel:
  Antworten mit Zitat      
Please describe how you tried to import and whether you tried CSVREAD.

Andreas
Private Nachricht senden Benutzer-Profile anzeigen E-Mail senden
 
2menace
Themenstarter

Forum-Newbie

Forum-Newbie


Beiträge: 2
Anmeldedatum: 14.05.13
Wohnort: Schweiz
Version: ---
     Beitrag Verfasst am: 14.05.2013, 10:07     Titel:
  Antworten mit Zitat      
with csvread I get the following error:

??? Error using ==> dlmread at 145
Mismatch between file and format string.
Trouble reading number from file (row 1, field 1) ==> "1846

it doesn't seem to 'find' the number due to the quotation marks.

before I just opened the file in the editor, replaced all " , saved the file and used importdata(Filename); which worked but isn't how I'd like to continue
Private Nachricht senden Benutzer-Profile anzeigen
 
jurtsche
Forum-Century

Forum-Century


Beiträge: 123
Anmeldedatum: 26.03.13
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 14.05.2013, 10:47     Titel:
  Antworten mit Zitat      
Code:
fid = fopen('test.txt');
x = textscan(fid,'"%f" "%f"','delimiter', ',')
fclose(fid);
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.