3x3 Matrix - always Error "unexpected impression"

18 vues (au cours des 30 derniers jours)
Leonie Wollscheid
Leonie Wollscheid le 29 Oct 2017
Modifié(e) : KL le 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.
>>

Réponses (1)

KL
KL le 29 Oct 2017
Modifié(e) : KL le 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,

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by