Does matlab consider a complex number a vector, since i tried to make a switch, with a complex number being the decision making element and i got an error...i am going to solve the error, but i need to know if it is not caused by the a matlab compiler definition: complex number = vector ?

 채택된 답변

Wayne King
Wayne King 2012년 4월 8일

0 개 추천

No, a complex number is 1x1 in MATLAB, not 2x1
Can you provide an example of where your switch fails?
z = 1+1j;
switch z
case 1+1j
disp('This executes');
case 1+1j*2
disp('This does not');
end

댓글 수: 1

Tlale
Tlale 2012년 4월 8일
Hello, I am demapping complex symbols into bits, so i was using a configuration much like the example you gave but ive been fighting with it and it keeps saying that 'z'(in ur example,) is not a scalar and thus gives an error.
ive since switched to using an if statement=>
can you please look at my other question

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

질문:

2012년 4월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by