Best way to export long double data from C into Matlab

What is the best way to import very large matrices of long double data from C (on Linux) into MATLAB? Please answer so that someone new to both C and MATLAB (that's me) can understand. Thanks.

2 件のコメント

Jan
Jan 2012 年 10 月 23 日
Are you talking about 80bit values stored in the memory - if so, how are they stored? Or do you mean 80bit values stored in a text or binary file - if so, please explain the format.
Jeff
Jeff 2012 年 10 月 24 日
I'm pretty new to the low level details of programming. I see I didn't provide near enough information.
The data is calculated one row at a time by an ode solver. I access it one row at a time. I don't have direct access to the data because it is in an object called an N_Vector. So I access it something like this
realtype *udata;
udata = NV_DATA_P(u);
for (n=0; n<my_length; n++)
printf("%5.4Lf\t", udata[n]);
Note that realtype is probably a long double and a one line C code returned that sizeof(long double) is 16 (bytes) and my system is little endian (does that even matter?).
I can't find the definition of NV_DATA in the documentation.
Note also that I want to save the entire precision (not just the four decimals in the printf statement).
Thanks.

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

回答 (1 件)

Sachin Ganjare
Sachin Ganjare 2012 年 10 月 23 日

0 投票

If you are importing from .dat file, refer below link:
Else could you please provide format of file wherein this matrices data reside?
Hope it helps!!!

1 件のコメント

Jeff
Jeff 2012 年 10 月 24 日
Please see my comment to the main question for more details (I know, I really didn't provide much at all). I have a long running program which generates data (from an ode solver). I want to save all of the data and import it into MATLAB for analysis. I think the link you provide will help. It is probably best for me to write the data to a file, which I can sneaker-net (remember that term everyone?) to the MATLAB machine.

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

カテゴリ

製品

タグ

質問済み:

2012 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by