Define permutation map on {1,2,3}
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to define a function
which
.
How could I do this?
0 Commenti
Risposte (1)
Voss
il 26 Feb 2022
% you can index into a vector:
S_vec = [2 3 1];
% or you can define an anonymous function:
S_func = @(x)mod(x,3)+1;
% they work the same:
S_vec(1)
S_vec(2)
S_vec(3)
S_func(1)
S_func(2)
S_func(3)
% and both work for vector inputs:
S_vec([1 2 3])
S_func([1 2 3])
0 Commenti
Vedere anche
Categorie
Scopri di più su Holidays / Seasons in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!