필터 지우기
필터 지우기

How to create a loop and store the outputs from table?

조회 수: 2 (최근 30일)
Rahul Verma
Rahul Verma 2023년 4월 29일
댓글: Stephen23 2023년 4월 29일
I have extracted the data from the perticular strata from the following code;
T = readtable('Dataset.xlsx');
n = length(T.Strata)
for i=1:n
if isnan(T.Strata(i))
T.Strata(i) = T.Strata(i-1);
end
end
data=T(T.Strata==3,1:end-1)
% Say: Strata 1 has one row of data, but strata 3 has two rows of data. So, if i recall the data from strata 3, it will read the whole data of strata 3 with the help of above code.
Now further, I have to calculate one more parameter whose formula is given below:
x= N1 * S1
Where N1 is the number of elements in respective strata and S is the stadard deviation of respective strata.
So, I have to create one loop, in which both the variables get its values respectively without assigning values manually. Or store the ouput according strata.
I have attached the "dataset" for reference.
  댓글 수: 1
Stephen23
Stephen23 2023년 4월 29일
None of Strata are NaN, so what is the loop actually supposed to achieve?
T = readtable('Dataset.xlsx');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
any(isnan(T.Strata))
ans = logical
0
Rather than that loop, use:
with 'previous' option.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by