MATLAB Answers

The difference between semicolon and comma

Asked by engineerOfPhysics on 31 Mar 2013

Hi matlab community ,

I am working on let' s say a homework. I realized that during the homework, The representations one of them x=[1,2,3] and x=[1;2;3] are different. What is the different between them? I get a solution using both of them but different.



No products are associated with this question.

1 Answer

Answer by Wayne King
on 31 Mar 2013
 Accepted answer
 x = [1,2,3];  

creates a 1x3 row vector.

 x =  [1;2;3]; 

creates a 3x1 column vector

  1 Comment

engineerOfPhysics on 31 Mar 2013

Well Why I get different result when I plot of sin(x) function ? between these values. ?

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!