필터 지우기
필터 지우기

i need a code to find the mean of a specific column from an excel sheet and find the variation of the mean and actual value and then display 'yes' if the the variation is 0.5.

조회 수: 2 (최근 30일)
i used a switch statement but i have a problem in finding the variation. there are almost 2000 iterations.
data=readtable("DATA.xlsx");
n = mean(data(1676-50:end,26),'omitnan');
switch n
case 0.5
disp('yes')
otherwise
disp('no')
end
how can i solve this
  댓글 수: 5
Aditi
Aditi 2023년 10월 27일
I need help to find the variation in one loop and then display the message
Rik
Rik 2023년 10월 28일
How are you defining variation? You're not using standard statiscal terminology I'm familiar with.
And do you know how to write a for loop? And are you aware that your current code requires an exact match with 0.5 (so there isn't room for rounding errors)?

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

답변 (1개)

SAI SRUJAN
SAI SRUJAN 2023년 11월 9일
Hi Aditi,
I understand that you are trying to find the variation of the mean and the actual value of a specific column.
To find the mean of a vector in MATLAB, you may utilize the 'mean' function. Following this, you can employ a 'for' loop to calculate the variation relative to each data point.
You can follow the given example to proceed further,
data=readtable("DATA.xlsx");
n = mean(data(1626:end,26),'omitnan');
v= data(1626:end,26);
for i=1:numel(v)
if isnan(v(i))==0
if abs(v(i)-n)==0.5:
disp('yes')
else
disp('no')
end
end
end
I hope this helps.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by