An array for multiple LHS assignment cannot contain expressions

I have array of values (192x2) and I want find the minimal value index (I don't care about the value);
This syntax makes sense to me but is not permitted:
index = zeros (ratio_channels, 1);
for i = 1: ratio_channels
[~, index (i)] = min (compare_onset(i), [], 2)
end
Error: An array for multiple LHS assignment cannot contain expressions.
Running it another way works but doesn't give me what I want (the value but not the index):
for i = 1: ratio_channels
index (i) = min (compare_onset(i), [], 2)
end

댓글 수: 1

what is the size of compare_onset(i), for example
size(compare_onset(1))

댓글을 달려면 로그인하십시오.

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 6월 13일

1 개 추천

Remove the white space in "index (i)"
[~, index(i)] = min (compare_onset(i), [], 2)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2018년 6월 13일

댓글:

2018년 6월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by