Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Reduce the data size in MATLAB

Subject: Reduce the data size in MATLAB

From: Maverick

Date: 22 Oct, 2010 17:32:06

Message: 1 of 8

My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
I highly appreciate if anyone can help me on this problem.


 

Subject: Reduce the data size in MATLAB

From: Sean

Date: 22 Oct, 2010 18:14:04

Message: 2 of 8

"Maverick " <monika.chauhan@mavs.uta.edu> wrote in message <i9shqm$q44$1@fred.mathworks.com>...
> My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
> I highly appreciate if anyone can help me on this problem.

It depends on how you want to down sample this:
Do you want a mean? a median? a straight extraction?

A straight extraction is the easiest:
M2 = M1(1:2:end,1:2:end,1:2:end);

Subject: Reduce the data size in MATLAB

From: Richard Willey

Date: 22 Oct, 2010 18:56:26

Message: 3 of 8

Hi Monika

Your large dataset has a bit more than 5 million data points. However, even
your hypothetical "small" dataset has 625K data points.
One way or another, you're going to need to use some kind of model to
approximate your data and then use visualization techniques to describe this
model.

For example, lets assume that your data existed in a 3D space. You might be
able to represent your data as a surface, where the shading represented
confidence bounds. Alternatively, you might need to plot a set of three
dimensional shells.

Also, from the looks of things, you're dealing with a four dimensional
dataset. You're going to need to decide how you want to visualize 4d data
in a 3d space.

If you can provide a bit more information, I might be able to make some more
specific recommendations.









"Maverick " <monika.chauhan@mavs.uta.edu> wrote in message
news:i9shqm$q44$1@fred.mathworks.com...
> My domain or data size is 500* 101* 101, since it is very huge for me to
> do the visualisation, so I need to reduce it 250*50*50 size, how can we do
> it in MATLAB.
> I highly appreciate if anyone can help me on this problem.
>
>
>

Subject: Reduce the data size in MATLAB

From: Maverick

Date: 22 Oct, 2010 20:39:05

Message: 4 of 8

Than you Sean for your help.
But when I am implementing it, my number of columns get reduced to 3 instead of 6 columns.
 I will show you my code.

N = 200;
prefix = 'fort.q';
fname = [prefix,num2str(N,'%4.4d')];
if ~exist(fname,'file');
    error('file not existent')
else
    INFO=1;
end
fid = fopen(fname);
F = fread(fid,1,'int32')*0;
while abs(F(1)) < eps(1)
    F = fread(fid,1,'int32');
end
A = fread(fid,4,'int32');
NN = round(A(end-2:end).')
%second line
F = fread(fid,1,'double')*0;
while abs(F(1)) < eps(1)
    F = fread(fid,1,'double');
end
A = fread(fid,5,'double');
DXYZ = A(end-2:end).';
for k = 1:3
    X{k} = (0:(NN(k)-1))*DXYZ(k);
end
A = fread(fid,inf,'double');
i1 = find(A>eps(1),1);
M = prod(NN);
L=1;
rho = reshape(A(i1+M*(L-1):i1-1+M*L),NN);
for L=2:6
    k=L-1;
   u{k} = reshape(A(i1+M*(L-1):i1-1+M*L),NN)./rho;
end
clear A
if exist('XT.dat','file');
    X{1} = load ('XT.dat');
end
rhou = u{1};
rhov = u{2};
rhow=u{3};
rhoE=u{4};
rhox=u{5};

Q=[rho(:) rhou(:) rhov(:) rhow(:) rhoE(:) rhox(:)];

Q2 = Q(1:2:end,1:2:end,1:2:end, 1:2:end, 1:2:end, 1:2:end);
OR
Q2 = Q(1:2:end,1:2:end,1:2:end)

HERE the number of cloumns get reduced to 3 I do want that.
Since my grid is 500*101*101, and this size is very huge to visualise it, so I need to reduce the size so that I can easily do the visualisation.
Please consider this.




"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i9sk9c$5st$1@fred.mathworks.com>...
> "Maverick " <monika.chauhan@mavs.uta.edu> wrote in message <i9shqm$q44$1@fred.mathworks.com>...
> > My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
> > I highly appreciate if anyone can help me on this problem.
>
> It depends on how you want to down sample this:
> Do you want a mean? a median? a straight extraction?
>
> A straight extraction is the easiest:
> M2 = M1(1:2:end,1:2:end,1:2:end);

Subject: Reduce the data size in MATLAB

From: Maverick

Date: 22 Oct, 2010 20:43:04

Message: 5 of 8

Hi Richard,

Thanks for your reply.
I know my dataset is quite huge, since I do not have to visualise, this is the someone else 's work, but I have the data and he needs data in a smaller size. He just want to first check with the smaller data then he will look into the huge data.
So just wondering how can I reduce my data from 500*101*101 to any smaller dimenions like 250*50*50 or either 256*64*64, depends which I can able to create it.
Suggest me in this regard.
 

"Richard Willey" <rwilley@mathworks.com> wrote in message <i9smoq$h4s$1@fred.mathworks.com>...
> Hi Monika
>
> Your large dataset has a bit more than 5 million data points. However, even
> your hypothetical "small" dataset has 625K data points.
> One way or another, you're going to need to use some kind of model to
> approximate your data and then use visualization techniques to describe this
> model.
>
> For example, lets assume that your data existed in a 3D space. You might be
> able to represent your data as a surface, where the shading represented
> confidence bounds. Alternatively, you might need to plot a set of three
> dimensional shells.
>
> Also, from the looks of things, you're dealing with a four dimensional
> dataset. You're going to need to decide how you want to visualize 4d data
> in a 3d space.
>
> If you can provide a bit more information, I might be able to make some more
> specific recommendations.
>
>
>
>
>
>
>
>
>
> "Maverick " <monika.chauhan@mavs.uta.edu> wrote in message
> news:i9shqm$q44$1@fred.mathworks.com...
> > My domain or data size is 500* 101* 101, since it is very huge for me to
> > do the visualisation, so I need to reduce it 250*50*50 size, how can we do
> > it in MATLAB.
> > I highly appreciate if anyone can help me on this problem.
> >
> >
> >
>

Subject: Reduce the data size in MATLAB

From: Matt J

Date: 22 Oct, 2010 21:10:08

Message: 6 of 8

"Maverick " <monika.chauhan@mavs.uta.edu> wrote in message <i9shqm$q44$1@fred.mathworks.com>...
> My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
> I highly appreciate if anyone can help me on this problem.
=======

If you want to reduce by averaging 2x2x2 neighbourhoods, you can do as follows.

Tx=kron(speye(250),[1,1]/2);
Tyz=kron(speye(50),[1,1]/2); Tyz(end+1,end+1)=1;

theResult=KronProd({Tx,Tyz},[1 2 2])*A;


This will require you to download the following FEX submission,

http://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-kronecker-product-manipulation

Subject: Reduce the data size in MATLAB

From: Matt J

Date: 22 Oct, 2010 21:28:03

Message: 7 of 8

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <i9sujg$erd$1@fred.mathworks.com>...
> "Maverick " <monika.chauhan@mavs.uta.edu> wrote in message <i9shqm$q44$1@fred.mathworks.com>...
> > My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
> > I highly appreciate if anyone can help me on this problem.
> =======
>
> theResult=KronProd({Tx,Tyz},[1 2 2])*A;
=====
 
...where A was your original 500x101x101 array and theResult is the
250x50x50 array that you are looking for.

Subject: Reduce the data size in MATLAB

From: Maverick

Date: 25 Oct, 2010 02:43:03

Message: 8 of 8

Hi Matt,

Thank yo all for the suggestions.
I got the answer and required data set.

Monika


"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <i9svl3$mg3$1@fred.mathworks.com>...
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <i9sujg$erd$1@fred.mathworks.com>...
> > "Maverick " <monika.chauhan@mavs.uta.edu> wrote in message <i9shqm$q44$1@fred.mathworks.com>...
> > > My domain or data size is 500* 101* 101, since it is very huge for me to do the visualisation, so I need to reduce it 250*50*50 size, how can we do it in MATLAB.
> > > I highly appreciate if anyone can help me on this problem.
> > =======
> >
> > theResult=KronProd({Tx,Tyz},[1 2 2])*A;
> =====
>
> ...where A was your original 500x101x101 array and theResult is the
> 250x50x50 array that you are looking for.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us