- What is your input, in matlab?
- What is your expected output?
- What did you try, in code?
- What is the exact error matlab returned?
How to convert a cell to a string?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have attempted to convert a cell to a string using cellstr (which doesn't work)... I need a column of cells (all containing numbers) to be strings so I can manipulate them. Thank you!
댓글 수: 7
Jan
2018년 2월 20일
편집: Jan
2018년 2월 20일
@Lexington Stoyell: Flags are used to mark inappropriate message, but Birdman ask you to provide your input, such that the readers can help you. Therefore I've removed your flag "Um why?". The answer is trivial: Because Birdman wants to help you and needs details to do so.
You do not tell us, what exactly your inputs are and what the error message is - although you have been asked for this twice already. This makes it hard to help you.
The column is said to be a cell.
Please explain this clearly. Who said what?
I want to convert this to a string so I can then use strsplit() and use
the comma as a delimiter to split the column into two different columns.
This is not clear also. There is no unique conversion of a cell, which contains numbers to a string. There is no need to concatenate the converted numbers only to split them afterwards.
[~, ~, dat] = xlsread('My_File.xlsx');
A = Value_Col;
B = Limits_Col;
H = cellstr(B);
What is the purpose of this code? dat is not used. Value_Col and Limits_Col are defined elsewhere and I cannot even guess, what they contain.
This is your 3rd thread about this topic and you still do not answer the questions for clarifications. See Question 382677 and Question 382677.
Please post your input and tell us exactly, what you want as output. Leave the idea of "splitting a column into 2 columns at the comma", because this is not meaningful. Vectors do not contain commas, but they are inserted for a better display on the screen only. Show us the contents of the Excel file and explain, what you want to achieve.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!