How can i store string in cell without apostrophe?

I want to store say A50 in cell ..but i dont want apostrophes in it like 'A50'..how can i do it.?
I tried to use string to number and string to double but it didnot work.
Thanks in advance.

 채택된 답변

David Sanchez
David Sanchez 2013년 7월 25일

0 개 추천

M = cell(1,1);
str = 'A50';
str = char(str);
M{1} = str;

댓글 수: 5

exactly what i wanted..thanks !!
I used
>> var_1 = 'A50';
>> C{1,1}{1,1} = char(var_1);
but its not working..
Are you watching the value in the variable editor? For a cell C, the variable editor presents the cell-array data with apostrophes, but when double-clicked, selecting single cells of the cell-array, the string appears without the apostrophe.
siddhesh rane
siddhesh rane 2013년 7월 25일
편집: siddhesh rane 2013년 7월 25일
thanks a lot sir..one last question
If i create a text file from the data then will it have apostrophes?
Note that char makes absolutely no difference when its input is already of type char:
A = 'A50' % variable A already has type char,
A = 'A50'
B = char(A) % so function CHAR does absolutely nothing here.
B = 'A50'
whos
Name Size Bytes Class Attributes A 1x3 6 char B 1x3 6 char
isequal(A,B)
ans = logical
1

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품

태그

질문:

2013년 7월 25일

편집:

2021년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by