필터 지우기
필터 지우기

can someone give me an example of what a "vector composed of characters" looks like exactly?

조회 수: 4 (최근 30일)
title. just need an thorough example

답변 (1개)

Steven Lord
Steven Lord 2022년 12월 4일
A = 'orange'
A = 'orange'
A is a vector of type char. It has 1 row and 6 columns.
If you're working with multiple pieces of text data and you're using a release where this data type is present, prefer using a string array instead of a cell array with char vectors or a char matrix.
B = ["orange"; "apple"; "watermelon"]
B = 3×1 string array
"orange" "apple" "watermelon"
If you tried to store these three fruits in a char matrix, the first two names would be padded with spaces so they're as long as the longest name. String arrays don't require this padding.
C = char(B)
C = 3×10 char array
'orange ' 'apple ' 'watermelon'

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by