How to write a cell array with different data types to a text file while still maintaining the same row and column dimensions of the cell array

1 次查看(过去 30 天)
I have a large cell array which is around 4000x7. It is composed of segments of different .txt files that were read in using textscan. Bits and pieces of these .txt files were taken to make the cell array. I now want to write this cell array to a new .txt file while maintaning the same dimensions that are in my cell array. The problem is that this cell array is made up of a variety of data types: doubles, strings, empty cell, and cell data types. And they are not in a pattern within the cell array (meaning they aren't organized by column or row for a particular datatype). I have spent a long time looking over Mathworks and haven't found anything that really helped. Alot of examples I did find gave me errors (because of the cell data type) or weren't really feasible for the size of the cell array I was dealing with. I did find several references to a cprintf and I tried to utilize it, but was unsuccessful. Any help would be much appreciated!
  1 个评论
dpb
dpb 2016-6-21
Well, cell arrays are wonderful things in some ways, but... :)
You're going to have to iterate thru the cell array, determine what the type and shape and "do the right thing" for each.
If, as you indicate, there isn't any uniformity with the cell of the content (a cell of cells, maybe?) then it's going to become a challenge.
A small sample of what you're dealing with might help; it's very difficult to do anything at all definitive w/o any specifics to look at.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by