Unrecognized function or variable 'tradeoff'

I am trying to execute a code on Matlab from a known script and i am receiving this answer:
Unrecognized function or variable 'tradeoff'.
The scrip was made to a version of matlab in 2017, and using a open-source toolbox for MATLAB called MTEX
The script:
% Use trade-off curve to find cutoff between well-constrained and poorly-constrained grains
knee = tradeOff(fraction);
xlabel('Number of grains (cumulative)')
ylabel('Indexed fraction')
I tried to change for different forms like "TradeOff" "Tradeoff" "tradeoff" "tradeOff
If someone could help me I would really appreciate it
Thank you

 Accepted Answer

The only reference I can find in the File Exchange is MTEX2Gmsh.
If this is the correct citation, you will need to download and install it.

4 Comments

Thank you for the quick answer!!!
I am already using Mtex2Gmsh.
Do you think is a problem with the software?
My pleasure!
I thought that the problem was that you needed the function and did not have it.
The MATLAB version is likely not the issue.
The ‘tradeOff’ reference appears to be to a function, since it has an argument that is likely not an index (unless ‘fraction’ is an integer greater than zero, and that seems unlikely). I looked at the ‘Functions’ section of that File Exchange contribution, and could not find ‘tradeOff’ listed among them (however a number of its functions have names that could overshadow MATLAB functions with the same names (such as ‘mesh’), which is something I urge you to consider if there are any conflicts).
The only other option is that ‘tradeOff’ is a function that was apparently written locally and the script you are using does not have access to it. The best approach is to contact the author of the script you are using (if possible) and ask where to find the ‘tradeOff’ function. Otherwise, use the appropriate operating system function (such as Windows File Explorer) to see if it exists somewhere on your computer. If it does (it is likely a separate function file), copy it to somewhere on your MATLAB search path so your script will have access to it. Also, look on the computer your script was written on to see if ‘tradeOff.m’ exists somewhere on it. If it does, then copy it and transfer it.
I really appreciate all support and ideas!
All the best

Sign in to comment.

More Answers (1)

The tradeOff function is a script used in the paper of Cross et al. (2017) - you can download it from the supporting information section of their publication. Store the tradeOff.m script in the same folder as your matlab project and then the code "knee = tradeOff(fraction)" should work automatically.

Categories

Products

Release

R2023b

Tags

Asked:

on 10 Jan 2024

Answered:

on 5 Mar 2024

Community Treasure Hunt

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

Start Hunting!