How to read in data from file using specific lines?
Afficher commentaires plus anciens
Hi! I have a project dealing with plotting bezier curves from a data file. The first value of the data file (data.m) is the number of curves that will be plotted on the graph which I already coded. Then each set of lines correspond to the x and y values. I am trying to read this data into my program by calling out the odd lines for the x's and even lines for the y's. However it is not working and I didn't take into account the spaces. How can I be able to read in this data file into my program in order to sucessfully run in? I can easily hard code it but unfortunately cannot do that as when my program will be tested, the numbers of the file will be different.
data.m (NOTE: comments are not actually on the file! Just adding them to describe the values)
3 %number of curves
0 0 0 0 %x values
0 3 3 6 %y values
0 4 4 0 %x values
6 6 3 3 %y values
0 1.5 1.5 3 %x values
3 1.5 1.5 0 %y values
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import and Export dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!