MATLAB: Vec2ind is not supported for code generation

code generationdigital image processingmatlab functionmatrix manipulation

vec2ind is not supported for code generation. Is there any other way to solve this issue?

Best Answer

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)
Related Question