The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Generate code from simulink
Replies: 1   Last Post: Nov 11, 2012 4:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 11/11/12
Generate code from simulink
Posted: Nov 11, 2012 3:53 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am using simulink to generate code for an embedded system and I want to implement a counter that is increased every time someone presses a button, to this I add the embedded matlab function block and I have the following code:

function [x, y, z] = fcn(u)

x = uint8(0);
y = uint8(0);
z = uint8(0);
counter = uint8(0);

if(u == 1)
counter = counter + 1;

if(counter > 5);
x = uint8(1);
if(counter > 10);
y = uint8(1);
if(counter > 15);
z = uint8(1);


simulink then generates no counter part, but if the remainder
I tried changing the way of doing the count but still generate.
The system does not show error message, so what settings should I continue to force Simulink to generate this code?
Thank's for any help

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.