1
$\begingroup$

I am studying wavelets in image processing. I would like to learn how to downsample a matrix in columns using MATLAB. I have used the downsample(x,n) command to downsample the given matrix in rows. But how to do the same in columns?

x =

 1     2     3
 4     5     6
 7     8     9
10    11    12

y = downsample(x,2)

y =

 1     2     3
 7     8     9

But I would like to get the following result.

y=
     1       3
     4       6
     7       9
    10      12

How to do it in MATLAB? Please help.

$\endgroup$

closed as off-topic by datageist Dec 13 '14 at 19:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "General programming questions are off-topic here, but can be asked on Stack Overflow." – datageist
If this question can be reworded to fit the rules in the help center, please edit the question.

3
$\begingroup$

Maybe Off-Topic here, but anyway !

Try it

y = downsample(x',2)'
$\endgroup$
  • $\begingroup$ Thanks a lot .. It works.. It's simple. Don't know how I missed it. Thanks again. $\endgroup$ – Premnath D Nov 8 '13 at 17:30
-3
$\begingroup$

Do not use the downsample function.

I used simple method in MATLAB:

x= [1 2 3;
    4 5 6;
    7 8 9;
    10 11 12];

x1=x(:,1:2:end)

Have a good time. ^^

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.