Loading cell array data from a .dat file reformatting data into doubles?

3 ビュー (過去 30 日間)
Justin Sung
Justin Sung 2019 年 6 月 20 日
コメント済み: Justin Sung 2019 年 6 月 20 日
hi all,
Basically, my problem is that I have a 2D cell array full of data that has a mixture of numbers and strings that contain numbers. I saved this huge cell array into a .dat file so that I could reference it later. When I try to load the data in, Matlab auto formats it into a double matrix and I lose my information contained in the strings. Within my cell array, I have data in the for of 0 and x_y, where the x and y can be any real number. I can't describe it clearly, so I've attatched a few pictures of the behavior.
My .data file looks like this:
I ran this quick few lines to import the data:
[filename, directory_name] = uigetfile('*.dat', 'filename.dat');
fullname = fullfile(directory_name, filename);
data = load(fullname);
This saves the data into the variable . However, when I open to take a look, matlab has optimized(?) the strings into doubles, essentially taking only the first occuring number and the data seen here:
2_3 becomes just 2 and etc.
I was wondering I there was a special load function that would preserve my strings instead of formatting them into doubles. It seems like an easy fix to go in manually, but I really want to save this as a last resort since the matrix is well over 1000x1000 in size ...
Thanks in advance
  2 件のコメント
infinity
infinity 2019 年 6 月 20 日
Justin Sung
Justin Sung 2019 年 6 月 20 日
ohhhh.... it worked....
thanks for taking the time to help, I appreciate it

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by