Azzera filtri
Azzera filtri

I want to generate a sequence of n number

2 visualizzazioni (ultimi 30 giorni)
SANJOY MONDAL
SANJOY MONDAL il 23 Dic 2017
Commentato: SANJOY MONDAL il 23 Dic 2017
i want to generate a sequence like 1 1, 1 2, 1 3, 2 1, 2 2, 2 3, 3 1, 3 2, 3 3, ...

Risposte (1)

Roger Stafford
Roger Stafford il 23 Dic 2017
n = 3; % <-- Choose any positive integer n
t = 1:n;
M = [reshape(repmat(t,n,1),[],1),repmat(t',n,1)];

Categorie

Scopri di più su Multidimensional Arrays 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!

Translated by