Cell arrays and strings

조회 수: 1 (최근 30일)
Ido Gross
Ido Gross 2020년 4월 6일
답변: David Hill 2020년 4월 6일
Hi,
I am working with cell arrays, and sometimes when I'm assigning strings in cells its saves as {["A"]} and sometimes as {'A'}. What is the difference, and how to access the data in both ways?

답변 (1개)

David Hill
David Hill 2020년 4월 6일
String arrays, a=["abc","defg"], are different from character arrays, a=['abcdefg']. Each character is a different element in the array and can be indexed while in string arrays, each string is an element (not the characters). See documentation for a cell array for indexing into a cell array. Basically, if you index with () you get a subset of the cell array and if you index with { } you get what is stored in that location.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by