I'v read and re-read the help about the function sprintf in matlab but I do not understand everything about this function and the format they talk about.
I was asking myself the logic behind the function formats.
If I run the example
sprintf('%05d%s%02d%s%02d',546,'.',1,'.',3)
I get
00546.01.03
which is logic, since the first number (546) is written as an integer and with 5 digits, the second is a character, and so on... But if now I try this
sprintf('%05d%s%02d%s%02d',546,'.',1,'.',3,4)
I get
00546.01.0300004
the first part is the same as above... But the last part of it (00004) has the format '%05d', that corresponds to the first format I entered in the function's arguments. My question is then Does the first format become the 'default' format ?
By trying this
sprintf('%05d%s%02d%s%02d',546,'.',1,'.',3,4,56)
and getting this
00546.01.03000048
I think the answer is no... But why ? And what is then the logic behind those arguments?
Thanks for your help !