Help with fopen and fread in a loop
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Marnie
 le 13 Mai 2015
  
    
    
    
    
    Modifié(e) : Walter Roberson
      
      
 le 13 Mai 2015
            I have been trying to open to open some bin files for Pressure and read their values into a 202 x 122 matrix then make a heat map of them. This is proving simple enough individually but I'm trying to read 101 of these files and I can get them opened easy enough but I can't get them to read...... what code should I be using for my fread function to go through each step?
for i = 0:101
fid = fopen(sprintf('P_0%i.bin',i));
P = fread(????????, [202 122])
HMobj = HeatMap(P)
end
The files are P_00.bin, P_01.bin, P_02.bin etc etc
Thankyou
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 13 Mai 2015
        
      Modifié(e) : Walter Roberson
      
      
 le 13 Mai 2015
  
      P = fread(fid, [202 122]);
fclose(fid);
Don't forget to save all of your HeatMap objects, or pause() or drawnow(), so that the user has a chance to see them. Graphics are not updated until you reach the command line or until pause() or drawnow() are called.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Polygons dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

