How to change output from column to row?
Show older comments
a = input('Enter first number:');
b = input('Enter second number:');
for A=a:b
reshape(A,1,[]);
fprintf('%d \n', A)
end
this is my code but I cant change the answer to horizontal orientation
The output goes like this
Enter first number:1
Enter second number:3
1
2
3
Accepted Answer
More Answers (1)
Sydney Lang
on 17 Jul 2020
Edited: Sydney Lang
on 17 Jul 2020
1 vote
I'm not quite sure what you're doing with the reshape.
Use the .' notation to transpose a matrix
x = 1
2
3
x = x.';
x = 1 2 3
Categories
Find more on Programming 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!