simulink error related to diff of a vector

1 次查看(过去 30 天)
I am using a function block in simulink. suppose "score" is a vector of size [1000 1]. i store the index of the maximum value in score in ind3 : [~, ind3] = max(score); I know that the initial value of ind3 = 1. Then i want to store something like: storing = sum(diff(score(1,1:ind3)).^2), which will be the output of the function block. But, i keep getting error message related to variable matrix sizes such as
SUM with one variable-size matrix input of [] is not supported. Block MATLAB Function2 (#100) While executing: none
I have noticed that i do not get any error if i use something like storing = sum(diff(score(1,1:100)).^2) but as soon as i put ind3, i get the errors.
Thank you
  6 个评论
pemfir
pemfir 2013-5-15
Another error i get : The working dimension was selected automatically, is variable-length, and has length 1 at run-time. This is not supported. Manually select the working dimension by supplying the DIM argument.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by