Read data and make (x,y) coordinates from data
    3 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Nora
 le 25 Oct 2013
  
    
    
    
    
    Commenté : Walter Roberson
      
      
 le 27 Oct 2013
            There is this data file that has the format where there is a letter x, space, then the x value, letter y, space, then the y value.
x 0 y 1 
x 1.3 y 2.2 
... (continued)
how can I write a script that will makes these x and y values into points and then plot them.
finally, it should close the file and say if it was closed successfully or not.
This is what I have so far:
load hw92.dat
FID = fopen(file, 'r');
if FID == -1 
    fprintf('ERROR CANNOT OPEN FILE TO READ!'); 
else
    % I am not sure how to do make the (x,y) part
    fclose(file);
end
Not sure how to do the rest of it.
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 25 Oct 2013
        datacell = textscan(FID, 'x%fy%f', 'CollectData', 1);
xycoords = datacell{1};
8 commentaires
  Walter Roberson
      
      
 le 27 Oct 2013
				Okay, and after you use the code that you posted, what does the variable xycoords contain?
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Variables 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!