This video shows how to
attach numbers to
strings, that is, how to accomplish number
to string concatenation.
this technique to make a sequential list of titles, file names... or
variable needs to be put in a string.
This is done with the built-in function num2str
and loops. If you type ‘help
num2str’ on your Matlab command window, you get
the following description:
Convert numbers to a
the matrix X into a
string representation Twith about 4 digits
and an exponent if required. This is useful for labeling plots
with the TITLE, XLABEL, YLABEL, and TEXT commands.
It means that you then
get a string version of the number
and can concatenate it to other strings in a logic sequence. A string
is a row
vector of characters and you can put them inside a pair of brackets.
technique is not recommended to create variables like a1, a2, a3... in that
case it’s better to use some type of indexing, like a(1), a(2)... or, in
general a(i), where i is a positive