help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with reading csv (textscan)


From: Nicholas Jankowski
Subject: Re: Problems with reading csv (textscan)
Date: Mon, 19 Aug 2019 12:53:37 -0400



On Mon, Aug 19, 2019 at 12:34 PM basic_coding <address@hidden> wrote:
>
> Thanks for quick answer.
>
> So here is the simple 3 lines of code I used for the original file:
> file = 'C:\......path_to_file....\messungen1'
> fid = fopen(file, 'r');
> [data] = textscan(fid, '%s %s %f %s %f %s %f %s %f %s %f %s %f %s %f %s %f'
> ,'delimiter',';');
>
>
> As this didn't work I tried to create a simple csv with comparable content:
>     2019-08-16-10:27:28 ;    value 1 ;    5.83 ;    value 2 ;    13 ;
>     2019-08-16-10:27:30 ;    value 1 ;    6.73 ;    value 2 ;    14 ;
>
>
> Using the follwoing code lines, I managed to read the data:
> file = 'C:\......path_to_file....\filename.csv'
> fid = fopen(file, 'r');
> [data] = textscan(fid, '%s %s %f %s %f' ,'delimiter',';');
>
> Sorry for the missing lines.
>
>

Thanks for the quick followup.  As I mentioned before, I also tried various combinations of options for textscan to see if it could pull in your data.  playing around with delimiter,  MultipleDelimsAsOne, the format string, etc. and I wasn't able to get it to output all of the data. it would always grab the first date string, sometimes the first few %s and first %f, but just empty cells after the first %f.  Maybe someone better with formatted strings can see what's causing the problem.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]