How to ROUND the elements of cell array?

조회 수: 18 (최근 30일)
Rounak Saha Niloy
Rounak Saha Niloy 2022년 9월 11일
답변: Paul 2022년 9월 11일
I have the followin struct with field.
K>> child
child =
struct with fields:
x: {[3×9 double]}
K>> child.x
ans =
1×1 cell array
{3×9 double}
How do I round the contents of child.x upto 3 decimals?

채택된 답변

Paul
Paul 2022년 9월 11일
% example data
rng(100)
child.x ={rand(1,3)};
format long
child.x
ans = 1×1 cell array
{[0.543404941790965 0.278369385093796 0.424517590749133]}
round(child.x{1},3)
ans = 1×3
0.543000000000000 0.278000000000000 0.425000000000000

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by