cell array to char array?

raktim banerjee · Apr 28, 2023 · 2K views
Question
Hello Sir!   How to convert a cell array to char array? I want to read 2 strings from a .txt file and want them in char type. if I do as follow those are cell type. The file contains 2 strings in 1st line, separated by a single space.   [a,b] = textread('inp.txt','%s%s',1)  
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 13, 2026
>> a = {'9a','abc'}

a =

'9a' 'abc'

>> char(a)

ans =

9a

abc
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!