0

I kknow I can pad a number up to 3 digits this way:

prematrix = sprintf('%03d', prematrix);

but what if I want a number of digits stored in a for example?

Cher
  • 163

1 Answers1

1

I don't know Matlab, but just googled strcat and this should work (untested) for 12 zeros:

a='%0';
b='12';
c='d';
d=strcat(a,b,c);
prematrix = sprintf(d, prematrix);
jitter
  • 153