Transpose x from a row vector to a column vector using the transpose operator. The program is prompting the x does not have correct values. the code i have entered is below
Show older comments
TASK
Transpose x from a row vector to a column vector using the transpose operator.
The code i wrote is the following
x=[1:5;]
x=x'
Test Results:
Incorrect!
Does x have five elements? ok
Is x a column vector? ok
Does x have the correct values? Not correct
1 Comment
Stephen23
on 29 Oct 2024
Note that in MATLAB the transpose operator is actually .'
Answers (2)
Alan Stevens
on 9 Jun 2021
You probably meant
x = [1:5]; % ie the ; is after the ]
However, it seems to work ok for me as you wrote it!
1 Comment
Stephen23
on 29 Oct 2024
You probably meant
x = 1:5;
because the square brackets are completely superfluous.
Hammad Ur Rahman
on 23 Jun 2021
0 votes
write
x=x'
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!