How to use cell type arrays in Simulink MATLAB function block
Show older comments
I am trying to create an array of arrays (cells I suppose) of constants so I can iterate over the constants and not create a separate loop/function call for each set of arrays. My structure is as follows:
CONSTANTS = {
{
{ 100, 10, 1},
{ 200, 20, 2},
{ 300, 30, 3}
},
{
{ 110, 10, 1},
{ 210, 20, 2},
{ 310, 30, 3}
}
};
and I am trying to attempt a loop similar to the following:
for i=1:length(CONSTANTS)
for j=1:length(CONSTANTS{i})
f = doSomething(CONSTANTS{i}{j}(1),CONSTANTS{i}{j}(2),CONSTANTS{i}{j}(3));
end
end
Is this possible in a Simulink MATLAB block even though Simulink can't use a "cell" type? Can I create an array of a user defined class?
Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!