I have 2 strings type datas. One of them (txt) comes from [FileName,PathName] = uigetfile(​'*.xlsx','​Select the excel file'), [num,txt1,raw] = xlsread(FileName), other is string data as matrix form. ı cannot put spaces between these strings.

for example,
[FileName,PathName] = uigetfile('*.xlsx','Select the excel file')
[num,txt,raw] = xlsread(FileName) %one excel file selected...
txt={p.1;p.2;p.3} % cell
string_txt=char(txt) % in order to convert string data
a=[1;2;3] % string
data=[txt, a] %
I wanna combine "txt" and "a" as 3x2 matrix and assign these matrix into listbox. When I create [txt, a] I cannot seperate columns to each other, they looks united without spaces. How can I seperate the columns to each other and assign this data into listbox?
thanks in advance.

 Accepted Answer

Like I said in your duplicate post:
result=[howdy(2,:), ' ', names(3,:)];
or use sprintf(), like I prefer:
result = sprintf('%s %s', howdy(2,:), names(3,:));
By the way, if any names are not exactly the same length as the others, then you'll have to have names be a cell array, not a character array and you'll have to use braces, not parentheses, like I did here.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!