write a function generate 6 unique random integers between 1 and 49 the name of the function should be Lucky6 it should has no input argument and one output argument (t)
the output argument (t) is a1-by-6 vector including generated integers.
Examples
t=9 13 16 26 30 33
t=5 12 23 34 37 45
t=4 8 22 27 41 49

댓글 수: 1

Rik
Rik 2021년 7월 7일
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks).

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2021년 7월 6일

0 개 추천

Read about the function randi.
Bhavya Chopra
Bhavya Chopra 2021년 7월 7일

0 개 추천

The described function can be written as follows:
function t = Lucky6()
t = randi(49,1,6);
end
Please refer to the documentation for writing a function in MATLAB and the use of function randi for generating random numbers.

댓글 수: 1

Rik
Rik 2021년 7월 7일
Providing complete solutions to homework questions is discouraged, as it encourages cheating.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2021년 7월 6일

댓글:

Rik
2021년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by