I am not sure why my function is undefined for input arguments double.

1 回表示 (過去 30 日間)
Jomarck
Jomarck 2022 年 9 月 26 日
回答済み: Chunru 2022 年 9 月 26 日
% Enter the commands for your function here.
x = random_number
function [check_range] = numberChecker(random_number, check_range)
if (random_number < 10 & random_number > 0)
check_range = 1
else
check_range =-1
end
end

採用された回答

Chunru
Chunru 2022 年 9 月 26 日
x = rand([-20 20]); % generate random number in range [-20 20]
% call the function
% output function_name input_argument
check = numberChecker( x )
check = -1
function [check_range] = numberChecker(random_number)
if (random_number < 10 & random_number > 0)
check_range = 1;
else
check_range =-1;
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Mobile についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by