Excluding data points from a file

2 次查看(过去 30 天)
I have a data file full of lengths and areas of cube cluser at tifferent time. The format of the data file looks like:
t a r
0 1 .23
0 4 1
... ... ...
Though the points are relevant, I don't need them all. What I'd like is to have mat lab plot the points for whenever a > 4. But every time I try something, I run out of memory (note: there are 52500+ points in this data file, hence why I'm trying to get rid of unnecessary points). Is there a way that it can go through all the data, and plot when a is grater than 4 with the corresponding r? If I could allocate the memory, that'd be great but I have to do this for multiple files, and each file has a different total number of points, so I can't just fix a number to the memory matrix. The code looks like the following so far:
fia=(fopen('data.txt');
A = fscanf(fia, '%f %f %f', [3,inf]);
a1 = A(2,:);
r1 = A(3,:);
a=a1(a1>4);
hold all
plot(log(r),log(a));
Would a while function work, for I tried hat, but I still ran out of memory. Thank you.

采纳的回答

Image Analyst
Image Analyst 2013-6-1
Did you also do
r = r1(a1>4);
??
Why not just try subsampling:
a = a1(1:64:end);
r = r1(1:64:end);
Assuming the nature of the points doesn't really change much from the beginning to the end, this could give you the general impression of what the whole data set looks like, while plotting a lot fewer points. You probably only have a couple thousand pixels across your screen so it doesn't make much sense to plot more than that.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by