How to get output in rows for running given matlab program(attached) 2 times for same inputs ?
조회 수: 2 (최근 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
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!