필터 지우기
필터 지우기

data extraction from a cell - indexing

조회 수: 16 (최근 30일)
Elisabeth
Elisabeth 2024년 6월 19일
답변: aditi bagora 2024년 6월 26일 10:33
Hi
in the MATLAB programming course (https://matlabacademy.mathworks.com/R2024a/portal.html?course=mlpr#chapter=2&lesson=6&section=1) it is explained how cell array indexing works:
"You can index into a cell array using standard MATLAB indexing with parentheses, (). this returns a portion of the orgiginal cell array, and is therefore itself a cell array.
You can access the contents of cells in a cell array by indexing with curly braces, {}, rather than parentheses, ()."
Does this mean that { } dereference a pointer whereas () gives a pointer?
Lisa
  댓글 수: 3
Elisabeth
Elisabeth 2024년 6월 20일
MATLAB is based on C (not C++) and its most important data structure is an array, designed to handle linear algebra problems. Why is MATLAB not based on C++? Is MATLAB a kind of aggregation level regarding C? Has it something in common with an interpreter? During my learning process I always come back to these questions and I would like to have a rough idea about what I am working with.
Stephen23
Stephen23 2024년 6월 20일
편집: Stephen23 2024년 6월 20일
"MATLAB is based on C"
MATLAB is not "based on C". The foundational concepts of MATLAB evolved before C was first released in 1972:
If anything, the biggest influence on MATLAB is probably FORTRAN.
Do not confuse the MATLAB language with the MATLAB JIT engine (mostly written in some kind of C). Do not confuse what languages the MATLAB JIT engine is written in with what language the MATLAB language is based on. Mixing things up will not help you understand how to use MATLAB or Python or any other high-level language.

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

답변 (1개)

aditi bagora
aditi bagora 2024년 6월 26일 10:33
Hi Elisabeth,
I understand that you are curious regarding the cell arrays datatype.
In my understanding cell arrays are a data structure developed for handling heterogeneous data types within a single container. Since, a cell array can store another cell-array or any other data type; different ways of retriving the information from cell arrays is defined in MATLAB.
In order to retrieve a content from a cell within a cell array "{}" are used; whereas to retrieve a portion of cell array "()" is used.
These are simple retrieval methods to retrive a portion of the cell array or a value in the cell.
Please refer to the following MathWorks documentation for more information:
Hope this helps!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by