Entering data into cell array

조회 수: 1 (최근 30일)
Dobs
Dobs 2021년 11월 30일
댓글: Matt J 2021년 11월 30일
Hi,
how do you enter data into a cell array?
I have the following empty array:
noble_gases = cell(5,4,1)
noble_gases = 5×4 cell array
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
Into the left column I want to enter the names of the noble gases. In the second column the symbol, the third column the atomic mass etc.
How do I enter the data so that it is in its specific place?
Many thanks,
Dobs

답변 (1개)

Matt J
Matt J 2021년 11월 30일
noble_gases{1,1}="Hydrogen";
noble_gases{1,2}="H";
etc...
  댓글 수: 2
Dobs
Dobs 2021년 11월 30일
So there isn't a faster way of doing it?
Matt J
Matt J 2021년 11월 30일
It depends what you are given. Do you already have the data organized in a different form?

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

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by