MATLAB Answers

0

convert character array to cell

Asked by Rashmil Dahanayake on 6 Aug 2014
Latest activity Answered by AJ von Alt
on 6 Aug 2014
Hi, I'm trying to generate a file list using a system command.
[status ,out]=system('dir mat')
The format of the variable is in char format. How can I save this in a cell, to display each line in a new row of the cell.

  0 Comments

Sign in to comment.

Products

1 Answer

Answer by AJ von Alt
on 6 Aug 2014
 Accepted Answer

You can use strsplit to split the string into cells. For your output, you can use the line feed character char(10) as the delimiter, so a new cell is created for each new line.
out_cell = strsplit(out,char(10))';

  0 Comments

Sign in to comment.