Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Correct syntax for textscan() function

Asked by John on 13 Feb 2012
Latest activity Edited by Laura Pop on 9 Oct 2013

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

0 Comments

John

Tags

Products

No products are associated with this question.

1 Answer

Answer by Friedrich on 13 Feb 2012
Accepted answer

Hi,

try %s as format string

out = textscan(fid,'%s')

(fid is the filepointer created by fopen)

4 Comments

Friedrich on 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 on 13 Feb 2012

Thanks very much

John on 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

Friedrich

Contact us