Clear Filters
Clear Filters

Coder deleting variable definitions

2 views (last 30 days)
Why oh why does coder feel the need to delete my variable definitions from time to time? It is unbelievably frustrating having to redefine 200+ variables.
  13 Comments
Kaustubha Govind
Kaustubha Govind on 14 Jun 2012
Adam: I think I'm a little confused about your workflow. Perhaps you should consider sending your files and reproduction steps to MathWorks Tech Support and verify if this is expected behavior or a bug?
Adam Kaas
Adam Kaas on 14 Jun 2012
I will send this to them. I think it is a bug. I figured out how to recreate the problem 100% of the time though. You can test this yourself and let me know if your results vary. Create a coder project, and on the overview tab, when you add an entry-point file, make sure you define at least one field. Then left click on the entry-point files name and hold it just longer than a click. If you drag that file even the slightest, your field definitions will be erased.

Sign in to comment.

Accepted Answer

Fred Smith
Fred Smith on 26 Jun 2012
Hi Adam,
Sorry to hear about your frustration. If you have 200 variables you might want to consider a different approach.
Have you looked at using codegen from the command-line instead of the UI? You can use "pre-conditioning" to incorporate your type definitions directly into your MATLAB code. This mechanism is verbose but solid. In many cases you can auto-generate the pre-conditions using some helper scripts. This feature is also available through the UI as of R2012a although it is somewhat hidden in the Settings dialog.
Another possibility in the UI, is to define your inputs by example. If you have appropriates variables in the base workspace, MATLAB coder can automatically figure out the types from those.
Hope this helps,
Fred
  1 Comment
Adam Kaas
Adam Kaas on 26 Jun 2012
Thanks Fred. I never ended up getting it reported (ironically the bug report page bugged out...) but thankfully I got everything I needed from Coder and no longer need to use it. I will look at using codegen in the future as it sounds to be a much more painless process. Thanks again!

Sign in to comment.

More Answers (1)

Rich McKeever
Rich McKeever on 26 Jun 2012
Adam,
We saw your post about the issue here and fixed the bug yesterday. A patch is available here, but I also second Fred's suggestion of using other methods for defining large numbers of inputs.
Thanks,
Rich

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!