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

5 visualizaciones (últimos 30 días)
Marco Alvarez
Marco Alvarez el 25 de Jun. de 2019
Comentada: Star Strider el 25 de Jun. de 2019
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

Respuesta aceptada

Star Strider
Star Strider el 25 de Jun. de 2019
You most likely need to enclose the name in single quotes:
lottopick('john'),
  2 comentarios
Marco Alvarez
Marco Alvarez el 25 de Jun. de 2019
wow! i was way over thinking this! thank you!
Star Strider
Star Strider el 25 de Jun. de 2019
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by