Question:

What does %s stand for in matlab? As in the command textread('mydata.dat','%s %s %f %d %s','headerlines',1)?

by Guest32975  |  earlier

0 LIKES UnLike

What does %s stand for in matlab? As in the command textread('mydata.dat','%s %s %f %d %s','headerlines',1)?

 Tags:

   Report

1 ANSWERS


  1. When reading formatted files it means 'Read a white-space or delimiter-separated string'. What your command does it reads mydata.dat file and expects data be formatted as in: str str num int str (note whitespaces ' ') and it will skip first line ('headerlines' + integer 1 at the end of command). Your command should output something like this:

    varargout = {'firststring', 'second string', 123.123, 4, 'third'} (output is not actually cell array, you should use your command as [str1 str2 num1 int1 str3] = textread('mydata.dat','%s %s %f %d %s','headerlines',1) )

    %s does not have any specific meaning in matlab (it is commented letter 's'), in this case it is used as a special fuction argument.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.