Vector inputs in functions
Mostra commenti meno recenti
How do I make a function so that it accepts any vector input? I need to create a function that returns a random element of the input vector. I know I need to use rand or randi for it, but I don't know how to input the vector.
Risposte (1)
Walter Roberson
il 18 Set 2015
function y = randsample(x)
y = x(randi(numel(x));
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!