Welcome, Guest
Username: Password: Remember me

TOPIC: TelemacTools Matlab read results at each time step

TelemacTools Matlab read results at each time step 5 years 6 months ago #33568

  • Alex
  • Alex's Avatar
Hi everyone,

I'm using TelemacTools with Matlab to read my result file. I want to import all my results at each time step in Matlab, so I use telheadr.m to read Telemac results file header and after that I use a loop "for" to extract at each time step my file result :

Fichier='./my_resu';
info= telheadr(Fichier);
nb_stp=info.NSTEPS;

for n=1:nb_stp
Data{n}=telstepr(info,n);
end

But I've got a problem with the loop, it creates the Data structure but it is fill in with 0 like it didn't read the file. If I don't use a loop and choose just one time step (the 10th for example):
Data=telstepr(info,10);
there is no problem, my results are correct.

So I think it's in the loop but I can't identify my bug, is anyone already have this king of error ? Or an idea of my mistake ?

Thanks,

Alexa
The administrator has disabled public write access.

TelemacTools Matlab read results at each time step 5 years 6 months ago #33571

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
Hi Alexa,

I tried your piece of code, and it seems to work for me.
You should be able to access your model results via the Data{1,n}.RESULT array which has the dimension (info.NPOIN, info.NBV).

(By the way, no need to store the whole structure for each time step, the RESULT array should be enough)

Regards,
Laurent
The administrator has disabled public write access.

TelemacTools Matlab read results at each time step 5 years 6 months ago #33579

Hi Alexa,

Normally, the telheadr/telstepr only works when you overwrite the structure with data as shown in the code below. As mentioned earlier, it is normally better not to store all time steps
Fichier='./my_resu';
info= telheadr(Fichier);
nb_stp=info.NSTEPS;

for n=1:nb_stp
   info=telstepr(info,n);
   % do something here with the data in info
end

Kind regards,

Alexander
The administrator has disabled public write access.
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.