Correct syntax for textscan() function

Hello there,
Would anybody know the correct syntax to import a column of time values from a text file using the textscan() function. The format of the time values is like this:
12:57:00
15:19:00
08:07:00
10:36:00
Many thanks

 Akzeptierte Antwort

Friedrich
Friedrich am 13 Feb. 2012

0 Stimmen

Hi,
try %s as format string
out = textscan(fid,'%s')
(fid is the filepointer created by fopen)

4 Kommentare

John
John am 13 Feb. 2012
Hi,
Thank you for replying.
I'm sorry but I'm only new to Matlab. If I have the the times values saved in a text file called time.txt and it is in the current folder, how would I load it?
Apologies if this a very simple question.
John
Friedrich
Friedrich am 13 Feb. 2012
No Problem. Thats what this platform is for :)
fid = fopen('time.txt','r')
out = textscan(fid,'%s')
fclose(fid)
out{1}
John
John am 13 Feb. 2012
Thanks very much
John
John am 13 Feb. 2012
Hello,
One more question, if you don't mind?
How would I convert the array of values to a vector to I could import the data into the dfitool.
Thanks again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Tags

Gefragt:

am 13 Feb. 2012

Bearbeitet:

am 9 Okt. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by