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 Matlab Function Block Question

Status
Not open for further replies.

pyrite

Member level 2
Joined
Aug 9, 2004
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
0
matrix inputs to matlab function blocks

Hi,
In simulink, there is a matlab function block. I wrote a matlab function with 3 inputs and 1 output. First input is a matrix and the next two inputs are integer.

The matlab function block in simulink has only one input. Is there a way to modify the block so that it can take 3 inputs?

Thanks!
 

elnenez

Member level 1
Joined
Dec 31, 1999
Messages
40
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
225
simulink function block

Hi,

You could use a mux block to group several signals in the same line. But in your case it's not possible becase one input is a matrix and the dimension of the signals to be grouped would be different. Maybe the best solution is to create a S-Function, but it is more complex.
 

pyrite

Member level 2
Joined
Aug 9, 2004
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
0
Thx. S Function is kinda complicated. What I want to do is actually quite simple.

In simulink, I have a matrix in workspace. I am trying to make a block so that it will output only one data out of the matrix according to the x,y location.

For example, my matrix is [1 2; 3 4]. When the input x=1, y=2, i want the block to output "4".

My plan was to use matlab function block that take the matrix and x,y as input. Is there any other workaround in simulink?

Thanks in advance!
 

elnenez

Member level 1
Joined
Dec 31, 1999
Messages
40
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
225
Hi,
After reading your post I think that the block you are looking for is a lookup table 2-D. This block has two inputs, which are used to access the elements of a matrix, defined inside the block (you can use its workspace name).
 

    pyrite

    Points: 2
    Helpful Answer Positive Rating

pankaj jha

Full Member level 3
Joined
Apr 16, 2010
Messages
170
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
jaipur
Activity points
2,457
hi
if i use a mux block to group several signals in the same line, which is also the input of the matlab function block, will both the inputs be available to the matlab function block simultaneously?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top