Write MATLAB codes to recover the arrays x and y from the text file
here is the text file contents:
The following tabulates the pairs (x,y)
where y=x^2-x+2
1 2
2 4
3 8
4 14
5 22
6 32
7 44
8 58
9 74
10 92

and here are my codes to recover the arrays x and y:
fid=fopen('C:\Users\yash\Documents\MAT…
C=textscan(fid,'%d',1,'Headerlines',2)…
N=C{1};
D=textscan(fid,'%2d %4d',N);
fclose(fid);

it does not work when i enter D{1} and D{2} on the command window please help?

I'm in the same situation now, as I have to get ready to my laboratory tests. Thanks for arising this topic - I'm looking forward to get some useful tips, as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.