Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

simulink Embedded MATLAB Function

Status
Not open for further replies.

hameeds01

Advanced Member level 2
Joined
Aug 23, 2005
Messages
599
Helped
75
Reputation
156
Reaction score
41
Trophy points
1,308
Location
Islamabad Pakistan
Activity points
4,540
Hello everyone
I would appreciate if someone could help me, I am using “Embedded MATLAB Function” block in Simulink matlab, the problem is that I want to store the previous values of the variables that I am using in Embedded MATLAB Function block just like M-file code secondly I want to make them appear in workspace How I can do that ??





Regards
Engineer Asad Hameed
 

Why dont you use MATLAB function?

It is more closer to matlab syntax

Faster than embedded

Reliable for computing

And you can define its variables in workspace using global type variables
 

function [fnc2]=fnc2(M)

global fnc2;
global T;
global Jg;

fnc2=M*T/Jg;

end

This is a simple example. fnc2 output M input

Global adjective means variables are stored in workspace. If your output or input ports are vector, there is no need for change the syntax in first line.

For different rows of vector you can use fcn2(1),fcn2(2)... etc.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top