Insert 2 cell arrays in txt data

1 view (last 30 days)
Hi I have a really easy question. I have one cell Array which consists of 2 cells. I would like to write These two cells in txt data. Actually i can now write both cells in txt however i would like put tab between both two cell elements. Although I added \t. Matlab does not put tab both elements. Could u please help me.Here is my code.
for ii=1:length(combined_data(:,1))
fprintf(fid ,formatSpec, [com1,com2]);
thanx a lot

Accepted Answer

Renato Agurto
Renato Agurto on 20 Mar 2017
I think you need two %s separated by the tab:
fprintf(fid ,formatSpec, com1, com2); %without brackets
Renato Agurto
Renato Agurto on 21 Mar 2017
with brackets you join the 2 chars into one char. Without brackets you assign every char (com1 & com2) to the respective '%s' in your string.
I hope this helps you

Sign in to comment.

More Answers (0)


Find more on Programming Utilities in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!