Info

This question is closed. Reopen it to edit or answer.

Unsing workspace data in matlab function block in simulink

2 views (last 30 days)
For example, when I have workspace data
A=3;
B=7;
I want to make an Matlab function block in simulink
with 3 inputs and 1 output for example
function f = my_block(x,y,z)
%#codegen
syms A B
% This function was generated by the Symbolic Math Toolbox version 6.2.
% 11-Jan-2016 15:08:47
f = (x+y)*A + B*z;
and for many cases that various values of A and B
I want to do the simulations by using that simulations
but that makes error
Undefined function or variable 'A'.
Function 'my_block' (#45.189.190), line 8, column 11:
"A"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
I just mentioned about very simple example but I want to use very many variables in workspace (for example 8 by 8 matrix equations)
how to solve this error

Answers (1)

Walter Roberson
Walter Roberson on 11 Jan 2016
Symbolic toolkit cannot be compiled by MATLAB Compiler or MATLAB Coder. MATLAB Function blocks may be compiled in anything other than Normal mode. You need an Interpreted MATLAB block to use Symbolic Toolkit. Even then I do not promise that a symbolic object can be conveyed by a signal.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!