I'm trying to write a Matlab program that takes an input from the user for the number of rows to be displayed and accordingly prints something like :
1
2 2
3 3 3
.. so on
Now I could get this output using two for loops, but is it possible to do the same with one for loop? Specifically, I'd like to know if there's a way by which we could pass the iteration value of the for loop to the sprintf/fprintf statement to format the string in a way similar to '%3d' so that the sprintf/fprintf statement knows how many variables are to be printed on each line. Hope that wasn't too messy.
Thank you!
Shantanu.