run command 100 times and put the answers in one vector

1 view (last 30 days)
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)

Answers (1)

Star Strider
Star Strider on 4 Jul 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.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!