Convert MATLAB char array to string

 Starting with the MATLAB char array, A: 

 

A(1,1) = 'A'
A(1,2) = 'P'
A(1,3) = 'R'
A(2,1) = 'M'
A(2,2) = 'A'
A(2,3) = 'Y'

How can this be converted to a cell of strings, B, such that: 

 

 B{1} = 'APR'
B{2} = 'MAY' 

Edit: A is a cell and using the function cellstr gives the error 

 

Error using cellstr (line 23)
S must be 2-D.  

NOTE:-


Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.      

Answers: 

Use the following function: http://www.mathworks.com/help/matlab/ref/cellstr.html 

 

>> B =  cellstr(A)

B =  
SEE COMPLETE ANSWER CLICK THE LINK       
https://matlabhelpers.com/questions/convert-matlab-char-array-to-string.php

Comments

Popular posts from this blog

How to Perform LU Decomposition with Partial Pivoting in Matlab

How to calculate "Average Precision and Ranking" for CBIR system?

How to remove non-barcode region in an image? - MATLAB?