cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gulah
Visitor
Visitor
6,026 Views
Registered: ‎06-22-2008

How to use vectors in MCode block from System Generator?

Jump to solution

Why dosn't this works?

 

function z = SegundaTentatTeste(y)
um = [0 1 2 3 4 5 6 7];
z=um(3)
end

 

 It says this in the Simulation Diagnostcis:

"Error("SegundaTentatTeste.m"): Syntax error: Encountered "1" at line 2, column 9" 

0 Kudos
1 Solution

Accepted Solutions
gulah
Visitor
Visitor
6,258 Views
Registered: ‎06-22-2008

Found it:

 

function z = SegundaTentatTeste(y)
persistent v, v = xl_state([0.000000, 0.000001, 0.000002, 0.000003], {xlUnsigned, 100, 90});
z=xfix({xlUnsigned, 300, 160},v(0))
end

View solution in original post

0 Kudos
2 Replies
gulah
Visitor
Visitor
6,012 Views
Registered: ‎06-22-2008

I found out how to do it:

 

function z = SegundaTentatTeste(y)
persistent v, v = xl_state(1, 2, 3, 4], 100, 90);
z=v(0)
end

 

But now i have another question, how do i use Xfix? I tried this:

 

function z = SegundaTentatTeste(y)
persistent v, v = xl_state([xfix({xlUnsigned, 100, 90},0.000), xfix({xlUnsigned, 100, 90},0.001), xfix({xlUnsigned, 100, 90},0.002),xfix({xlUnsigned, 100, 90},0.003)], 100, 90);
z=v(0)
end
 

0 Kudos
gulah
Visitor
Visitor
6,259 Views
Registered: ‎06-22-2008

Found it:

 

function z = SegundaTentatTeste(y)
persistent v, v = xl_state([0.000000, 0.000001, 0.000002, 0.000003], {xlUnsigned, 100, 90});
z=xfix({xlUnsigned, 300, 160},v(0))
end

View solution in original post

0 Kudos