eegegg
eegegg

Reputation: 25

Is there a way to write a cell array with fprintf?

I have a variable (strings) that contains 192x14 cell array. I want to write this table into a text file. When I use fprintf, it says that "Function is not defined for 'cell' inputs."

For example:

strings = {'foo','bar','baz'};
fprintf('%s ',strings);

produces the error message

Error using fprintf
Function is not defined for 'cell' inputs.

Is there any other function that can do the trick?

Upvotes: 1

Views: 2323

Answers (1)

JAC
JAC

Reputation: 466

To avoid the error try fprintf('%s\n', cellarray{:}); that will write the elements of callarray one per line

Upvotes: 2

Related Questions