Error trying to get MATLAB to read dataset
Show older comments
I'm trying to get MATLAB to read values of K and q from the excel spread sheet named dataset(its attached) but everytime i do it I get this error (as shown below) and i dont know what to do as im quite a rookie at MATLAB
Error using solutionwithoutforcingtermorheatsource (line 39)
Subscripting into a table using one subscript (as in t(i)) or
three or more subscripts (as in t(i,j,k)) is not supported.
Always specify a row subscript and a variable subscript, as in
t(rows,vars).
for i=1:Ne
%read dataset for K and q values
K(i)= readtable('dataset.xlsx','Range','A2:A20');
q(i)= readtable('dataset.xlsx','Range','B2:20');
end
for i=1:Ne
h(i)=0.25;
A(i,i)=A(i,i)+K(i)/h(i)^2; A(i,i+1)=A(i,i+1)-K(i)/h(i)^2;
A(i+1,i)=A(i+1,i)-K(i)/h(i)^2; A(i+1,i+1)=A(i+1,i+1)+K(i)/h(i)^2;
end
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!