我正在使用Simulink模塊MATLAB FUNCTION,並且遇到了我在那裏定義的變量邊界問題。由於Simulink Matlab函數塊中可變大小數據導致的錯誤
這是代碼的在那裏我得到的麻煩
部分function P_S1_100= fcn(SOC_S1_100,S1_AGENTS_10,time_CAP_100)
assert(time_CAP_100(1)<100)
tcharging_a1_1=[0:0.05:time_CAP_100(1)]
tcharging_a1_2=[time_CAP_100(1):0.05:time_CAP_100(1)*2]
tcharging_a1=[0:0.05:time_CAP_100(1)]
(其中time_CAP_100
是一個矢量[1X6])
這是我得到的錯誤:
Computed maximum size of the output of function 'colon' is not bounded.
Static memory allocation requires all sizes to be bounded.
The computed size is [1 x :?].
Function 'Subsystem1/Slow Charge/S1/MATLAB Function5' (#265.262.302), line 8, column 16:
"[time_CAP_100(1):0.05:time_CAP_100(1)*2]"
任何人都可以給我一個如何解決這個錯誤的想法嗎?
在此先感謝。
謝謝你的友好的答覆,但我仍然有同樣的問題。我遇到問題的變量不是輸入/輸出信號。 – user2615539
我已經限制了所有的輸入/輸出信號,但它沒有工作。我還嘗試將有問題的變量('tcharging_a1_2')作爲輸出信號進行陳述,並使用編輯數據框的選項來限制它。不過,我仍然得到相同的錯誤 – user2615539
嗯......你需要用'coder.varsize'函數聲明你的變量(http://www.mathworks.co.uk/help/simulink/slref/coder。 varsize.html)? – am304