- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Error in MCode Block
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-27-2012 02:44 AM - edited 06-27-2012 02:45 AM
Hallo everybody,
I would like to see the behaviour of some variables and counters inside my MCode Block. So what i did, I put these signals or variables as Inputs of my MCode Block after the simulation the following errors happen:
Error("control_module.m"): line 4:12 The persistent declaration must precede any use of the variable samples_counter. Error("control_module.m"): line 5:12 The persistent declaration must precede any use of the variable signals_counter.
Any suggestions are welcome
Thanks in advance
Cheers,
Olivier
Re: Error in MCode Block
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-27-2012 02:47 AM - edited 06-27-2012 02:53 AM
here is an extract of my code
Re: Error in MCode Block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-28-2012 12:37 AM
Hi,
as the error message said, you can't use some variable name before the persistent declaration, and the function parameter list is such a forbidden use.
I think you should use the debbugging methods offered by Matlab.
(Actually I have no experience with that)
Alternatively, you could use some other names in the parameter list, and then assign the persistent variables to these names in the code. (Q&D-Solution)
Have a nice simulation
Eilert
Re: Error in MCode Block
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-28-2012 01:11 AM
Thank a lot for your contribution. it give me already some ideas.
Cheers,
Olivier











