# Problem with direct calculation on table with std and "omitnan"

조회 수: 3 (최근 30일)
Jean-Marie Sainthillier 2023년 5월 17일
댓글: Star Strider 2023년 5월 17일
Since R2023a, it is possible to perform calculations directly on tables (and timetables) without extracting their data by indexing.
I want use std directly on a numeric table where I can have nan.
For example :
T = table(Age,Height,Weight,Systolic,Diastolic)
mean(T,"omitnan")
It's fine.
But why there is a problem with std(T,"omitnan") ?
% Applying the function 'std' to the variable 'Age' generated an error.
I can use std(T{:,:},"omitnan") or std(T.Variables,"omitnan") but I lost the possibility to work directly with my table.
Did I miss something ?
Do you have any suggestion ?
SAINTHILLIER Jean Marie

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

### 채택된 답변

Star Strider 2023년 5월 17일
Prehaps varfun?
Example —
T = table(Age,Height,Weight,Systolic,Diastolic)
T = 100×5 table
Age Height Weight Systolic Diastolic ___ ______ ______ ________ _________ 38 71 176 124 93 43 69 163 109 77 38 64 131 125 83 40 67 133 117 75 49 64 119 122 80 46 68 142 121 70 33 64 142 130 88 40 68 180 115 82 28 68 183 115 78 31 66 132 118 86 45 68 128 114 77 42 66 137 115 68 25 71 174 127 74 39 72 202 130 95 36 65 129 114 79 48 71 181 130 92
S = varfun(@(x)std(x,'omitnan'),T)
S = 1×5 table
Fun_Age Fun_Height Fun_Weight Fun_Systolic Fun_Diastolic _______ __________ __________ ____________ _____________ 7.2154 2.8365 26.571 6.7128 6.9325
.
##### 댓글 수: 2없음 표시없음 숨기기
Jean-Marie Sainthillier 2023년 5월 17일
It's strange, it works with varfun but not direclty.
Thank you Star Strider.
Star Strider 2023년 5월 17일
As always, my pleasure!

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

### 카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

R2023a

### Community Treasure Hunt

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

Start Hunting!

Translated by