Introduction to MATLAB MATLAB Command Window MATLAB switch
Sign up to view full document!
SIGN UP

Introduction to MATLAB


MATLAB外觀探討 § Command Window: 可在此輸入MATLAB的 指令


















switch之範例 和c語言的switch差別在於, 不需break fprintf在MATLAB裡等於c語 言裡的printf, 用法相同 § 範利 for month = 1: 12 switch month case {3, 4, 5} season = 'Spring'; case {6, 7, 8} season = 'Summer'; case {9, 10, 11} season = 'Autumn'; case {12, 1, 2} season = 'Winter'; end fprintf('Month %d ===> %s. n', month, season); end Month 1 ===> Winter. . . . Month 12 ===> Winter.








- Slides: 29