Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me store data in a file for KZK equation in Matlab

Status
Not open for further replies.

jakjoud

Full Member level 2
Joined
Feb 6, 2005
Messages
129
Helped
10
Reputation
20
Reaction score
1
Trophy points
1,298
Location
Marrakech
Activity points
954
Hi every body,
here is my pb, I've a long computing to do on matlab, so the memory is not enough, I thout to make a storing on a file but I don't know how in matlab!! I think that I must use something like fprintf and fscanf but it's not so easy
could you show me how thanks a lot
 

Re: about Matlab

Hi,
I know how to read and write files in Matlab, but I wonder whether file operation can
reduce memory useage.
 

Re: about Matlab

u can take help from MATLAB BY CHAPPMAN OR "RUDRAPRATAP "BOOK.
 

about Matlab

Can you explain a little more what you are trying to do? How much data you have? Does MATLAB need to access it randomly or sequentially?

The operating system is suppose to provide virtual memory to the application (by using the hard drive), so it behaves as if you have more RAM installed.
 

about Matlab

ok this is the problem, I have to resolve the KZK equation on Matlab, so I must take aver 30000 samples on the z axis and over 1000 samples on r axis and that's 10 times, which makes the virtual memory too small for such data, so I have the idea to make the computing on 500 samples on z then to save in a file, after I will take the 500 next, then I could reuse the same location in the memory.
Thanks.
 

Re: about Matlab

I am curious to know so.....who can help on this?
 

about Matlab

Still not clear. I don't know how the KZK algorithm works.

You have 30000*1000*10 samples. Yes that may be too big for virtual memory on a 32-bit computer.

Where are those gigabytes of data coming from? From a file? From a data acquisition device? Or are you generating all that data in MATLAB? And what do you want to do with all that data after processing? Write to a file? Output somewhere? Delete it?

Maybe you can create a loop that uses fread() and fwrite() to read/write your binary input/output data files sequentially, one small chunk at a time. If your data is ASCII (ouch!), then you could use fscanf() and fprintf() instead, but it'll be slow.

How about getting a 64-bit computer? That removes the 2GB limit. I think MATLAB now supports 64-bit Windows and Linux.
 

about Matlab

In Matlab simulation, you can save the state of the simulation. This is particular useful when the system resources (e.g. memory) are not enough. In other words, you can divide the simulation into multiple stages. At each stage, you save the result to a different file. After all stages are performed, you combined all the files. I can do this in Matlab/Simulink. In my opinion, it could be done for any m-file type of simulation.
 

about Matlab

It's about calculating a wave propagating into a medium, for this I define the source on 1000 samples, after and on 30000 samples on z, I must calculate every point using the results I found earlier. more clearly and briefly u(j+1,i,n)=[T]^-1*u(j,i,n)+Sn(j,i) where T is a 30000*1000*10 matrix, S(n) is defined using every point u(j,i,n). it's a little bit complicated. So I cant save the state of simulation into multiple stage 'cose I must restor everytime my data.
For using fscanf I had a problem on argument it's about the size of my data, it's double (the default wiith matlab). here's the problem.
Any way please if you have any idea communicate them to me, and I do the same.
than,ks friends
 

Re: about Matlab

In fact,
When i'm saving the calculated samples in a file, using fwrite, I can't make suree that they are in the true order, so is there any other function for files in matlab?
 

about Matlab

Excuse me, why You don't try to work in C++? You can easily pass Your data by the C++ program to Matlab (use the command LOAD in matlab to read a .dat file generate by C++).

When I did a M.C. Simulation about the DIRC (a detector who work with Cerenkov's effect, and is part of the BaBar Detector), I can Simulate 30000*300 extractions in only 5 minutes with a pentiom 2,4 Ghz with 512MByte RAM.

With Matlab, the same simulation, requires a life with that computer!
 

about Matlab

Dear paolone, my problem with C++ is that I have to calculate a matrix invers, and the best language for matrix computing is MATLAB, else I must write a long script to do this invers, and that will be more late than with MATLAB.
 

about Matlab

It is not very difficult to write a Matrix inverse caculation algorithm in C. You can check the book "Numeric in C".
 

about Matlab

OK thanks everybody, I think that I found the solution in matlab it's just the "write" and "read" but be careful about reading.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top