The outcome of the code below gives H T H T T depending on random function. How do I store the outcome of the 20 iterations into a variable called 'product' ; for example: product =[ H T H T T......] so that whenever I need it, I can fetch the outcome by just typing 'product' fprintf('The Outcomes are:\n')for i = 1:20 A = rand(i,1); if A(i) >= 0.5000 fprintf('%s\n', 'H'); else fprintf('%s\n', 'T'); endend
MATLAB: Storing fprintf as an array.
fprintf
Best Answer