Error in outputting a variable from function

Have a problem in trying to graph the outputs of my height function in my main file.

回答 (1 件)

James Tursa
James Tursa 2018 年 2 月 23 日

0 投票

Change your switch-case logic to if-then-else logic. E.g.,
switch h >= 0 && h <= 105
case h >= 0 && h < 11
:
case h >= 11 && h < 25
:
Would become this:
if h >= 0 && h < 11
:
elseif h >= 11 && h < 25
:
etc
:
else
error('Invalid height'); % catch invalid inputs here
end

1 件のコメント

Alexander Donaldson
Alexander Donaldson 2018 年 2 月 24 日
編集済み: Alexander Donaldson 2018 年 2 月 24 日
Does not fix the error of the undefined variables when running the main function. The attached file details the specifics what needs to be accomplished. Updated the new function-m file.

この質問は閉じられています。

製品

質問済み:

2018 年 2 月 23 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by