function in simulink matlab function block is not bounded
Mostra commenti meno recenti
I'm trying to figure about using convhulln in simulink for my own purposes and came across and error when running this code in an matlab function block in simulation mode:
function K = fcn()
P = rand(10,3);
K = zeros(12,3);
V = convhulln(P);
K(:,:) = V(1:12,:);
end

I'm aware of this sort of error and its why I preallocated K to an array of [12,3] and only pushed 12 values from V. But the error is not originating from the input or output of my own function, reather it seem that convhulln is causing this issue. Unless I'm miss reading https://www.mathworks.com/help/simulink/ug/control-memory-allocation-for-variable-size-arrays-in-a-matlab-function-block.html I can't think of how to make their suggestions apply to functions calls within a matlab function block where the size of the inputs to convhulln are static. Any idea of what I might not be considering?
2 Commenti
Hi Daniel,
What is the utility outputting only the first 12 rows of V? What if K has more than 12 rows?
rng(100)
size(convhulln(rand(10,3)))
Daniel Delannes-molka
il 12 Lug 2023
Risposte (1)
Angelo Yeo
il 12 Lug 2023
0 voti
Yesterday, when I looked into your previous question, I tried to fix the model. Please take a look and compare it with yours. See the attachment.
1 Commento
Daniel Delannes-molka
il 12 Lug 2023
Categorie
Scopri di più su Verification, Validation, and Test in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!