How to get output in rows for running given matlab program(attached) 2 times for same inputs ?

1 次查看(过去 30 天)
Hello Everyone,
Please see the attached matlab program which for example,i am running for input
online1([9 1 4; 8 2 3])
suppose, I want to run this program 2 times(Say count= 2) for same inputs, then how can i get 'second time run output' below first time run output. Means my output in command window should look like---
output from first time run
output from second time run
  3 个评论

请先登录,再进行评论。

采纳的回答

Geoff Hayes
Geoff Hayes 2014-8-25
reshdev - if you want to re-run your function multiple times with the same input, then just pass in a second input parameter indicating how many times you want to run the function
function online1(inputData, numRuns)
% set n based on the number of rows
n = size(inputData,1);
% do following for each run
for u=1:numRuns
% use your code from online.m
% row index into inputData
ridx = 1;
r = 6;
t = r-1;
output = zeros(r,r*n);
for ii = 1:r:r*n
% etc.
end
% now write output and run number
fprintf('output from run %d\n',u);
disp(output);
end
end
Try the above and see what happens!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by