3x3 Matrix - always Error "unexpected impression"

18 views (last 30 days)
Leonie Wollscheid
Leonie Wollscheid on 29 Oct 2017
Edited: KL on 29 Oct 2017
I tried so much but it doesn´t work anymore. I´ve learned to create in matlab a 3x3 matrix the following term: matrix(1 2 3; 4 5 6; 7 8 9) . The following sentences are my tries in different versions. Thanks for your help!:)
>> matrix(1 -1 4; 3 4 5; 5 6 5) matrix(1 -1 4; 3 4 5; 5 6 5) ↑ Error: Unexpected MATLAB expression.
>> matrix( 1 -2 4. 3 4 5. 3 4 5) matrix( 1 -2 4. 3 4 5. 3 4 5) ↑ Error: Unexpected MATLAB expression.
>> matrix(1 -1 4 ;3 4 5 ; 3 4 5) matrix(1 -1 4 ;3 4 5 ; 3 4 5) ↑ Error: Unexpected MATLAB expression.
>> matrix(1 -1 5 ;3 4 5 ; 3 4 5) matrix(1 -1 5 ;3 4 5 ; 3 4 5) ↑ Error: Unexpected MATLAB expression.
>> matrix[1 -1 4; 3 -2 0; 3 3 3] matrix[1 -1 4; 3 -2 0; 3 3 3] ↑ Error: Unbalanced or unexpected parenthesis or bracket.
>> matrix(1 -1 4; 3 -2 0; 3 3 3) matrix(1 -1 4; 3 -2 0; 3 3 3) ↑ Error: Unexpected MATLAB expression.
>> matrix(1 -1 4 ; 3 -2 0 ; 3 3 3) matrix(1 -1 4 ; 3 -2 0 ; 3 3 3) ↑ Error: Unexpected MATLAB expression.
>> matrix(1 2 3; 4 5 6; 7 8 9) matrix(1 2 3; 4 5 6; 7 8 9) ↑ Error: Unexpected MATLAB expression.
>> w=(1 -1 4;3 -2 0;3 3 3) w=(1 -1 4;3 -2 0;3 3 3) ↑ Error: Unexpected MATLAB expression.
>> matrix(1 3 3; 4 5 6; 7 8 9) matrix(1 3 3; 4 5 6; 7 8 9) ↑ Error: Unexpected MATLAB expression.
>> w[1 -1 4; 3 -2 0; 3 3 3] w[1 -1 4; 3 -2 0; 3 3 3] ↑ Error: Unbalanced or unexpected parenthesis or bracket.
>>

Answers (1)

KL
KL on 29 Oct 2017
Edited: KL on 29 Oct 2017
You use []
matrix_A = [1 2 3; 4 5 6; 7 8 9];
Instead of blindly trying random things, spend few minutes to read the documentation,

Categories

Find more on Creating and Concatenating Matrices 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!