Not enough input arguments error in function

1 visualizzazione (ultimi 30 giorni)
Manuel Schaefer
Manuel Schaefer il 18 Lug 2019
Commentato: Manuel Schaefer il 18 Lug 2019
Hi there,
I'm trying to use a function in matlab, but everytime i adress a variable that is given to my function, the failure: "Not enough input arguments" will occure.
My code is:
function[Szenario] = Szenarioerkennung(Kommentartrennung)
compare = strcmp(Kommentartrennung{1,1},'CPFA');
if compare == 1
...
end
The issue seems to be the variable Kommentartrennung, because I can't adress is in any way (like: a=Kommentartrennung) the same error will occure every time. However I can adress the variable in the original program where it is declared. If I type "Kommentartrennung{1,1}" in the Command Window, it will show 'CPNA' like it should.
My function ist saved as Szenarioerkennung.m.
Kommentartrennung is a table (but I also tried to convert is to array, cell and structure with the same result).
  2 Commenti
Adam
Adam il 18 Lug 2019
How are you calling the function? You need to pass that variable in when you call it.
Manuel Schaefer
Manuel Schaefer il 18 Lug 2019
Thanks, you just solved my problem!
I called it as "Szenarioerkennung" while I needed to call it "Szenarioerkennung(Kommentartrennung)".

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Containers in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by