Effacer les filtres
Effacer les filtres

Error in legend (line 263) when using genpath

2 vues (au cours des 30 derniers jours)
Dominik Rohrbach
Dominik Rohrbach le 16 Fév 2024
I'm trying to add a toolbox to my matlab using the genpath function.
addpath(genpath('C:\Users\E1024185\Desktop\MA\fieldtrip-fieldtrip-b525618'))
However, if I run the code i get the Error "Incorrect number or types of inputs or outputs for function 'flip'." with an Error in legend (line 263). I just cannot figure out what's going on and how to fix this.
Has anyone experienced this or knows how to solve this?

Réponse acceptée

Raj
Raj le 21 Fév 2024
When you use 'addpath(genpath('path_to_toolbox'))', MATLAB adds the toolbox and all its subfolders to the top of the search path. If the toolbox contains a function that has the same name as a built-in MATLAB function, the one in the toolbox will be called instead of the built-in one.
The error message you're seeing suggests that there's an issue with the 'flip' function. MATLAB has a built-in function named flip, and it's possible that the toolbox you are trying to add already has a function by the name 'flip', which is leading to a conflict
You can check for conflicts by using the 'which' command to find out which 'flip' function is being called by default. This will list all the flip functions MATLAB finds on the path, along with their locations.
which flip -all
Further if you find 'flip' function from the toolbox is causing the issue, you can consider either renaming it or removing the subfolder that contains the function from the path.
Additionally you can refer to the documentaion link of the 'which' command for better understanding-
Hope this helps!

Plus de réponses (0)

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by