Having trouble creating a table
8 ビュー (過去 30 日間)
古いコメントを表示
I am trying to make a table of the variables T and K. both have 9 values so there should be no issue with them being different sizes.At first they were both 1 row and 9 columns, but that came up wtih a similar error. I tried reshaping them into vectors of 1 column and 9 rows, but that didnt help.
disp(' ') %putting in a space for readability
disp('Q = 8000 cal/mol') %displaying the given variables
disp('R = 1.987 cal/(mol*K)')
disp('ko = 1200 min^-1')
disp('T = 100K-500K')
disp(' ') %putting in a space for readability
disp('computing the reaction constant') %solving the problem
Q = 8000;
R = 1.987;
ko = 1200;
T = 100:50:500;
disp('Reaction constant (k) = ko*e^(-Q/(R*T))')
k = ko.*exp(-Q./(R.*T));
knew = reshape(k,9,1);
Tnew = reshape(T,9,1);
TA = table(T,k) %error is in this line: Row index exceeds table dimentions
0 件のコメント
回答 (1 件)
Ollie A
2019 年 1 月 30 日
Make sure the variables you create your table with are column vectors. In this case I suspect your vectors are row vectors.
Just change this line and it should work:
TA = table(T',k');
Hope this helps!
6 件のコメント
Peter Perkins
2019 年 1 月 31 日
Walter is right: somewhere you created a variable named "table". That's the real issue.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!