Functions not found in compiled GUI

1 view (last 30 days)
Nick Bell
Nick Bell on 8 Sep 2015
Answered: Steven Lord on 8 Sep 2015
I have an issue with calling functions using eval in a compiled GUI. I get the error:
Error using eval
Undefined function 'downsample' for input arguments of type 'double'.
The code runs just fine on my computer, and I have previously compiled the same code without issue. The line appears in a function that is only called by a user input and does not call up any other functions in the GUI. I made a small change to completely unrelated code and now this line doesn't work. I previously used "decimate" in place of downsample and that stopped working on a new version after compiling (again, without changes to that section of code), and I found that changing it to downsample worked.
The code is as follows:
eval([ nam '=downsample(double(' list{e} '),double(Sample_rate/rr));']); % decimate the data down to the reduced rate from the full rate
Any guidance would be greatly appreciated.

Answers (1)

Steven Lord
Steven Lord on 8 Sep 2015
In general, I recommend against using EVAL. See the second problem on this documentation page. I STRONGLY recommend NOT creating variables with dynamic names like that; the first question in the Programming section of the FAQ offers alternatives that will work more robustly and potentially more quickly; avoiding the EVAL should also make that call to DOWNSAMPLE "visible" to the code analysis the Compiler needs to perform to determine what should be included in the application.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!