0

Consider the following variable declaration in C code:

Counter_Type counter_var;

It is a C code that a counter_var is defined with a specific type Counter_Type.

my question is: How it would be possible to declare a variable type which is used inside a MATLAB function in Simulink lead the generated code generates that variable with that specific type.

For instance consider the following code which is a simple odd number adder written in MATLAB as a MATLAB fucntion:

function Sum = sum_oddfcn(N)
Sum = 0; count = 1;
while ne(count,N)
    if mod(count,2) ~= 0
        Sum = Sum + count;
    end
    count = count + 1;
end
end

Now I want to know if there is a way to declare the count variable declared in the above function to be generated with a type of Custom_Type variable.

1 Answer 1

0

you can use add parameter in matlab function and define datatype in base workspace.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.