Undefined function or variable error
Ältere Kommentare anzeigen
vg=xlsread('CV_data.xlsx','F3:F103'); %Reading data from excel file.
capac=xlsread('CV_data.xlsx','H3:H103'); %Reading data from excel file.
cpad=interp1(vg,capac,vgate0,'pchip'); %Interpolating for vg=vgate0 to get cpad.
cgate=(cpad*cq)/(cpad+cq); %cq I have calculated before.
When I try to calculate cgate it gives an error :
Undefined function or variable 'cpad'.
2 Kommentare
KSSV
am 27 Jun. 2016
cpas is not defined..It could be empty matrix. Try checking what is cpad. Try to check vg,cpac which you are reading from xlsx files. Tehy are empty I guess.
Walter Roberson
am 27 Jun. 2016
Empty arrays would still exist and you would not get an error about undefined function or variable.
But there is no definition for vgate0 given, so the assignment to cpad could be failing; if so then you would get an error message for that before you got an error message in the cgate line.
cq is not defined in the code either.
Question: is vgate0 a scalar? If it is not a scalar then you probably want ./ instead of / when you calculate cgate
Antworten (0)
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!