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:
assigning value to matrix

Subject: assigning value to matrix

From: Arie Driga

Date: 3 Nov, 2010 13:05:05

Message: 1 of 4

Hello all,

I have a matrix with dimension of
A=axbxc

Is it possible to re-assign the value into a matrix of B=(a*b)xc?
Here is what I did:

d=a*b;
graph_data=zeros(d,c);
for l=1:d
    for i=1:a
        for j=1:b
            for k=1:c
            B(l,k) = A(i,j,k);
            end
        end
    end
end

It gives me answer, but I think it was wrong.

Subject: assigning value to matrix

From: Sean

Date: 3 Nov, 2010 13:29:04

Message: 2 of 4

"Arie Driga" <a_driga@yahoo.com> wrote in message <iarmm0$rtg$1@fred.mathworks.com>...
> Hello all,
>
> I have a matrix with dimension of
> A=axbxc
>
> Is it possible to re-assign the value into a matrix of B=(a*b)xc?
> Here is what I did:
>
> d=a*b;
> graph_data=zeros(d,c);
> for l=1:d
> for i=1:a
> for j=1:b
> for k=1:c
> B(l,k) = A(i,j,k);
> end
> end
> end
> end
>
> It gives me answer, but I think it was wrong.

doc reshape
doc permute

Subject: assigning value to matrix

From: Walter Roberson

Date: 3 Nov, 2010 17:30:30

Message: 3 of 4

On 10-11-03 08:05 AM, Arie Driga wrote:

> I have a matrix with dimension of
> A=axbxc
>
> Is it possible to re-assign the value into a matrix of B=(a*b)xc?

B = reshape(A, [], c);

Subject: assigning value to matrix

From: Arie Driga

Date: 4 Nov, 2010 08:14:05

Message: 4 of 4

Walter Roberson <roberson@hushmail.com> wrote in message <ias67q$c41$1@canopus.cc.umanitoba.ca>...
> On 10-11-03 08:05 AM, Arie Driga wrote:
>
> > I have a matrix with dimension of
> > A=axbxc
> >
> > Is it possible to re-assign the value into a matrix of B=(a*b)xc?
>
> B = reshape(A, [], c);

Thank you everyone..

Problem is solved.

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