Repeat all operations for n rows inside an array (with n unknown)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi everybody,
i have an array like this (with unknown rows number):
0.3 0.4 4
0.5 0.6 3.1
and i'd like to repeat different operations for every rows to obtain different results for different row.
Thank you!
댓글 수: 0
채택된 답변
Jan
2019년 1월 22일
편집: Jan
2019년 1월 22일
M = [0.3 0.4 4; ...
0.5 0.6 3.1];
nRow = size(M, 1);
for iRow = 1:nRow
yourOperation(M(iRopw, :)) ...
end
If you want to collect the results, use either a matrix again:
result(iRow, :) = ...
Or if the output has different sizes or classes, use a cell array:
Result = cell(1, nRow);
for iRow = 1:nRow
Result{iRow} = yourOperation(M(iRopw, :)) ...
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!