string printf in MatLab - sprintf -- MatLab

 string printf in MatLab - sprintf -- MatLab


How to print a formatted string? (e.g. s="%s %d";)

sprintf command.

[syntax]

sprintf(formattedStr,A1,A2,...);

[description]

print a formatted string which the formatted string is given by <formattedStr> argument
and the needs of <formattedStr> is given by A1,A2,...,An.

[NOTE]
Great Importance!!! Pay a lot of attention on it!!!

When error occurs, exception was not thrown and the compiler will not show error.
The sprintf will return error msg as ErrMsg.
When you want to  check what error msg is, you just have to type ErrMsg (without semicolon).
It has a great advantage. It will not throw error while running, it can be executed continuously.



e.g.








more details on:

Comments