Constant Value Output from matlab Function Block in Simulink
5 次查看(过去 30 天)
显示 更早的评论
Hi, I have a matrix Data(2556,4) , where in the first column represent the space traveled of the vehicle that I'm simulating.
I want to compare, during the simulation, the actual distance traveled of the vehicle S and with the column of the Data(:,1). I tought the best way is to use find() function, so once I know the index I could give the output relative to that index. The code is as follow:
function [ax, k, yaw] = Input_Commands(data, x, y)
s = sqrt( (x-0)^2 + (y-0)^2 ); % Creating the distance s from the starting grid
index = find( (s <= data(:,1)), 1);
ax = data(index,2);
k = data(index,3);
yaw = data(index,4);
The problem is that I get the following error: Data 'ax' is inferred as a variable size matrix, while its properties in the Model Explorer specify its size as inherited or fixed. Please check the 'Variable Size' check box and specify the upper bounds in the size field.
I don't know what to do. I tought the problem is the dimension of the output, so I've tried various solutions but with no success.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!