readcell function returns "failed to convert character code" error

6 ビュー (過去 30 日間)
nassos
nassos 2022 年 9 月 29 日
コメント済み: nassos 2022 年 9 月 29 日
Hi,
I have a cell array with 153 cells.
Each cell has inside a vector whose size might vary from a few thousands of collumns to even ~30M collumns.
The numbers in the vectors are double.
I use the command
writecell(trace_set,file_name)
to write the 'trace_set' cell array inside a file either '.csv' or '.txt'.
Creating the file takes a long time ( ~30min to 38min) and I end up with a files of ~15GB.
When I am trying to read back these files using the following command
readcell(fname)
I end up always with the following error:
Failed to convert character code.
This happens for either the '.txt' or '.csv' files.
How can this be resolved?
I am using Matlab R2021b on Centos 7.
Thank you in advance for the help.
Kind regards,
Nassos

採用された回答

David Hill
David Hill 2022 年 9 月 29 日
Just use save command.
  1 件のコメント
nassos
nassos 2022 年 9 月 29 日
Yes, using
save(file_name,'trace_set','-v7.3');
and saving in a '.mat' file, solved the issue as the file is now only ~5GB and the time to save it dropped to only 3min.
And I am able to load only individual cells of the cell array too.
Thanks @David Hill!
-Nassos
p.s. If anyone wants to chime in on why the writecell-readcell combination fails, feel free.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBiological and Health Sciences についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by