Undefined function or variable error
显示 更早的评论
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 个评论
KSSV
2016-6-27
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
2016-6-27
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
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!