How can i loop I and Ta values from excel sheet from column A(I values) & B(Ta values) for the below mentioned code from row 1 to 10000?
1 回表示 (過去 30 日間)
古いコメントを表示
I= 1100; % sample irradiance value
Ta = 46.89; % sample temperature value
c=0.0472*I+(1.6586*10^-8)*((Ta+273)^4)+ 4.29*(Ta+273); % equation using I and Ta values which have to be replaced from excel cells
p = [-1.658*10.^-8 0 0 -4.29 c]; % the quartic equation (4th power)
r = roots(p); %finding roots of the quartic equation
out = r(imag(r) == 0 & r > 0) %dispalying the real root value
For example i need the real root to be displayed for A2 and B2 value from the excel which are I and Ta values respectively for each iteration of all those 10000 values. i cant seem to code how to link this looping step. any help is appreciated.
0 件のコメント
回答 (1 件)
Sayam Ganguly
2017 年 7 月 19 日
Hi, I understand that you have an excel file with at least 10000 rows and 2 columns(A for I & B for Ta). Now you are trying to iterate through this excel and use the I & Ta values from each row for your calculation. Here is an approach that you can consider-
data = xlsread('Your file Name','A1:B10000')
for row = data'
I = row(1)
Ta = row(2)
%Code for your calculation goes here
end
Here the code reads the excel file from the specified range of cells(i.e. from A1 to B10000). In each iteration, it stores the "A" value in "I" and the "B" value in "Ta".
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!