CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   about gnuplot or matlab (http://www.cfd-online.com/Forums/main/2653-about-gnuplot-matlab.html)

Junseok Kim October 1, 2000 01:51

about gnuplot or matlab
 
How can I use gnuplo or matlab to plot a binary format data file?

Any help would be great except saying look at gunplot manual, I already did that.


Sebastien Perron October 2, 2000 06:16

Re: about gnuplot or matlab
 
I dont't think gnuplot can handle binary files. (I've just checked in te manual)

You will need to write a simple driver that read the binary format and translate it into ascii. (This is very easy in C or C++).

As for MATLAB, I've never used it and I can't help you.

clifford bradford October 2, 2000 18:42

Re: about gnuplot or matlab
 
Matlab uses the fread and fwrite command to read and write binary files.

Steve Amphlett October 3, 2000 04:52

Re: about gnuplot or matlab
 
I can't comment on gnuplot, but if you can program in C, you can easily get binary data into MATLAB for plotting.

MATLAB provides fopen, fread, fwrite and other C-like I/O library functions - these are OK for small(ish) amounts of data. If you want to do serious binary data import, you can write what MATLAB calls a MEX file. This is your own C code, wrapped by a MATLAB gateway function that allows you to read the data yourself, manipulate it and import it directly as a MATLAB variable. Once you've written your MEX file, using it is really easy. E.g.

>> x=read_my_data('filename');
:> plot(x(:,1),x(:,2));



All times are GMT -4. The time now is 00:22.