How to replace values of a variable in a table (in a cell) with nan?

조회 수: 3 (최근 30일)
Tomaszzz
Tomaszzz 2022년 10월 4일
댓글: Tomaszzz 2022년 10월 4일
Hi all,
I have a 10x1 cell containg 100x32 tables.
I want to:
mycell{5, 1}.myvariable = nan;
which results in:
Error using .
To assign to or create a variable in a table, the number of rows must match the height of the table.
How can I write the code to replace the values of a specified variable with nan?
Can you help please?
  댓글 수: 2
Rik
Rik 2022년 10월 4일
I'm on mobile so I can't test it, but perhaps this works:
[mycell{5, 1}.myvariable] = deal(NaN);
Tomaszzz
Tomaszzz 2022년 10월 4일
Thanks@Rik. Unfortunately the same error.

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

채택된 답변

VBBV
VBBV 2022년 10월 4일
mycell{5, 1}(1,1).myvariable = nan;
  댓글 수: 2
Tomaszzz
Tomaszzz 2022년 10월 4일
Thanks@VBBV. It results:
Error using ()
Adding rows or variables to a table by an assignment where () or {} subscripting is followed by additional
levels of subscripting is not supported.
The below replace the first row with nan; not sure how to apply it to all rows?
mycell{5, 1}(1,:).myvariable = nan;
Tomaszzz
Tomaszzz 2022년 10월 4일
ok now it works;
mycell{5, 1}.myvariable(:,1) = nan;

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

추가 답변 (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