Hi how can we print a matrice directly with 10*10 order
Show older comments
I want to print a matrix of the form 1 to 10 in a row i.e.,
1,2,.....10;
2,........1;
...........
...........
...........
10........9;
Can we directly do it in matlab
4 Comments
Azzi Abdelmalek
on 29 May 2013
Do you mean using a printer?
Krishna Prasad Rao
on 3 Jun 2013
Jan
on 4 Jun 2013
What exactly do you want to do? What is "a matrix of the form 1 to 10" and what do the dots mean? Of course we can try to guess such details, but it is more efficient, if you tell this more exactly. Thanks.
Krishna Prasad Rao
on 4 Jun 2013
Answers (1)
Perhaps you want:
c = 1:10;
M = hankel(c, fliplr(c)); % [EDITED]
fmt = [repmat('%d,', 1, 9), '%d\n'];
fprintf(fmt, M); % Usually you'd need M', but not here
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!