vec2ind is not supported for code generation?
조회 수: 2 (최근 30일)
이전 댓글 표시
vec2ind is not supported for code generation. Is there any other way to solve this issue?
댓글 수: 0
채택된 답변
Walter Roberson
2016년 11월 23일
In R2016b notation,
sum((1:size(vec,1)).' .* vec)
In earlier releases you would need
sum( repmat((1:size(vec,1)).', 1, size(vec,2)) .* vec)
댓글 수: 2
HASAN AL-KAF
2021년 10월 16일
Hi
The code doesn't give same result as vec2ind
for example vec= [1;0;1;0;1;1;5;0]
The result of vec2ind is 7.
The result of sum((1:size(vec,1)).' .* vec) is 50.
How can get exactly same result?. Becaue I want to transfer matlab code to c++.
Thank you.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!