lottopick(m) Undefined function or variable 'john'.

i have to create a random number generator. i think i got a code that would work but im having issues! when i call on the funciton, ie. lottopick(john),
it starts the function code but immediatley i get error undefined function or variable 'john'.
this is the code i have written thus far
function []=lottopick(name)
lotto = randi(54, [1 6 ]);
lotto=sort(lotto);
fprintf('%s, your lotto picks are %d %d %d %d %d %d \n', name, lotto)
end

 採用された回答

Star Strider
Star Strider 2019 年 6 月 25 日

1 投票

You most likely need to enclose the name in single quotes:
lottopick('john'),

2 件のコメント

Marco Alvarez
Marco Alvarez 2019 年 6 月 25 日
wow! i was way over thinking this! thank you!
Star Strider
Star Strider 2019 年 6 月 25 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by