Error using / Arguments must be numeric, char, or logical.
조회 수: 11 (최근 30일)
이전 댓글 표시
Hi,
I am trying to run the folllowing code and get the following error message. Can anyone help to clarify my mistake and possible solution ? This problem should come from the very last line of code. As information, my input is a table with 181 rows and 5 columns.
error message:
Error using /
Arguments must be numeric, char, or logical.
Error in Henrique_Transistors_in_beaker_mod (line 72)
Gateeff(m,1) = refV(91,1)/GateV(91,1);
code:
input = 'C:\Users\aasyuda\Desktop\histamine\28April2023\scan_1\andikaAugatehistamine4electrode-1.xls';
opts = detectImportOptions(input);
T = 1e-7; %Assume 100 nm thick channel
W1 = 50e-6;
L5 = 500e-6;
DrainV = -0.2;
n=181;
m=33;
%Output Variables
OnOffRatio = zeros(33,1);
WTL = [];
AvgGateI = zeros(33,1);
ThresholdVoltage = zeros(33,1);
LastGateI = zeros(33,1);
Gateeff = zeros(33,1);
AbsoluteDrainI=zeros(n,m);
AbsoluteGateI=zeros(n,m);
ElectrolyteV=zeros(n,m);
opts.Sheet = 1;
CurrentRun = readtable(input,opts);
WTL = (W1*T)/L5;
GateV = CurrentRun.AV;
MaxGateV = max(GateV);
DrainI = CurrentRun(:,3);
AbsoluteDrainI(:,m) = abs(table2array(DrainI));
MaxDrainI(m,1) = max(AbsoluteDrainI(:,m));
MinDrainI(m,1) = min(AbsoluteDrainI(:,m));
OnOffRatio(m,1) = MaxDrainI(33,1)/MinDrainI(33,1);
GateI = CurrentRun(:,1);
AbsoluteGateI(:,m) = abs(table2array(GateI));
AvgGateI(m,1) = mean(AbsoluteGateI(:,m));
refV = CurrentRun(:,5);
ElectrolyteV(:,m) = abs(table2array(refV));
Gateeff(m,1) = refV(91,1)/GateV(91,1);
댓글 수: 4
Walter Roberson
2023년 5월 4일
Good point about operations on table using the new R2023a facilities.
The user has marked they are using R2021b, so the new facilities do not apply to their situation, but your remark is a good reminder for people unfamiliar with the new facility.
Siddharth Bhutiya
2023년 5월 4일
Oh apologies, I did not notice that Andika was on R2021b. In that case, I think the way to go would be to use the second suggestion of doing {} or dot+paren subscripting to extract the data, do the division and the put it back.
답변 (1개)
Walter Roberson
2023년 5월 4일
The ability to do calculations directly on tables is not available until r2023a. Your refV is a table so refV(91,1) is a 1x1 table with one variable.
When you use () indexing on a table the result is a table.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Downloads에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!