For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > Resize a matrix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Resize a matrix
NeeDIX

2005-04-26, 9:02 am

Hi!

This is maybe simple, but I need to resize a matrix due to the length
of another one, so I can add those together,

any suggestion?

Regards
NeeDIX
Titus Edelhofer

2005-04-26, 9:02 am

help reshape

Titus

"NeeDIX" <nikeri02@ryp.umu.se> schrieb im Newsbeitrag
news:ef04058.-1@webx.raydaftYaTP...
> Hi!
>
> This is maybe simple, but I need to resize a matrix due to the length
> of another one, so I can add those together,
>
> any suggestion?
>
> Regards
> NeeDIX



NeeDIX

2005-04-26, 9:02 am

Hi!

But I have a (1*8 double matrix) and the other one is (1*192 double)
or something like that, I wont to be able to add zeros to the first
matrix so it always will be at the same length as the other one.

NeeDIX
Titus Edelhofer wrote:
>
>
> help reshape
>
> Titus
>
> "NeeDIX" <nikeri02@ryp.umu.se> schrieb im Newsbeitrag
> news:ef04058.-1@webx.raydaftYaTP...
> length
>
>
>

Titus Edelhofer

2005-04-26, 9:02 am

Hi,
then I'm not sure, what you want to to: do you just want to add the small
Matrix to the
large one? At which position? Does the following help?

A = zeros(1,192);
B = ones(1, 8);
ind = 1:length(B); % or e.g. ind = 5+(1:length(B));
A(ind) = A(ind) + B;

Titus

"NeeDIX" <nikeri02@ryp.umu.se> schrieb im Newsbeitrag
news:ef04058.1@webx.raydaftYaTP...[color=darkred]
> Hi!
>
> But I have a (1*8 double matrix) and the other one is (1*192 double)
> or something like that, I wont to be able to add zeros to the first
> matrix so it always will be at the same length as the other one.
>
> NeeDIX
> Titus Edelhofer wrote:


NeeDIX

2005-04-26, 9:02 am

Hi,

It seems to work, thanx for the help, now I just need to figure out
what you have done =)

Titus Edelhofer wrote:
>
>
> Hi,
> then I'm not sure, what you want to to: do you just want to add the
> small
> Matrix to the
> large one? At which position? Does the following help?
>
> A = zeros(1,192);
> B = ones(1, 8);
> ind = 1:length(B); % or e.g. ind = 5+(1:length(B));
> A(ind) = A(ind) + B;
>
> Titus
>
> "NeeDIX" <nikeri02@ryp.umu.se> schrieb im Newsbeitrag
> news:ef04058.1@webx.raydaftYaTP...
> double)
> first
one.[color=darkred]
to the[color=darkred]
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com