run command 100 times and put the answers in one vector

1 visualización (últimos 30 días)
avraham spring
avraham spring el 4 de Jul. de 2020
Respondida: Star Strider el 4 de Jul. de 2020
hello
if anyone can help me i wil appreciate it. i need to run the following command 100 times and then to gather all of the results into one vector. can some please tell me how can i do it?
a=[20 4 11 5 26 5]
b=randi([1 36],1,6)
c=intersect(a,b)
d=length(c)

Respuestas (1)

Star Strider
Star Strider el 4 de Jul. de 2020
Use a for loop. Assign the appropriate ‘results’ to a cell array (if they are different sizes in each iteration), or vector (if they are scalars), since I cannot determine what they are from yuour description.

Categorías

Más información sobre Loops and Conditional Statements 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