problem in calling a function, it does not recognize "switch case"
조회 수: 3 (최근 30일)
이전 댓글 표시
Please suggest the solution for the following problem. I am doing this in MATLAB 2021a. Thanks
I have three functions (1). function DSSK_Cons_Diagram = DSSK_Cons_Diagram_Gen(Nt )
(2). function DSM_Cons_Diagram=DSM_Cons_Diagram_Gen(Nt ,M)
(3). function DSMTConstellation_Mat = DSMT_Cons_Diagram_Gen(DSMT_SyS ,Nt ,M)
(1) and (2) works properly when I call them separately in the command window but the (3) has a problem it always says "unknown system". To call (3), I am writing like this,
DSMT_SyS =["dssk", "dsm"]; %DSMT_SyS is A string indicating the DSMT system for :
% −’DSSK’ for differential space shift keying ;
% − DSM’ for differential spatial modulation .
Nt=2,M=2;
DSMT_Cons_Diagram_Gen(DSMT_SyS ,Nt ,M)
The (3) is written here,
function DSMTConstellation_Mat = DSMT_Cons_Diagram_Gen(DSMT_SyS ,Nt ,M)
switch lower(DSMT_SyS)
case 'dssk'
DSMTConstellation_Mat = DSSK_Cons_Diagram_Gen(Nt ) ;
case 'dsm'
DSMTConstellation_Mat = DSM_Cons_Diagram_Gen(Nt ,M) ;
otherwise
error('Unknown system' )
end
end
댓글 수: 8
Dyuman Joshi
2022년 7월 11일
Oh, okay, eq is short for equality, alright. Thanks for the info, it's quite helpful!
Steven Lord
2022년 7월 11일
Most of the operators have a function associated with them that you can overload to overload that operator (for example, plus is the function you overload to customize how your class works with the + operator.) See the table on this documentation page for more information about the operators and their corresponding function forms.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!