Thread Subject: matrix

Subject: matrix

From: Handan Yaslan

Date: 4 Nov, 2009 13:40:04

Message: 1 of 5

Hi
I obtained the matrix A using a lot of calcultation in the for,
for i=1:N
    for j=1:N
        for k=1:N
          (I did a lot of calcultation ,so I obtained the matrix A )
                A
      end
   end
end

Main problem;
for every each step I want to see A matrix. For example
i=1 j=1,k=1 what is A?
i=1,j=1,k=2, A=?
i=N j=N k=N A=?

I tried B(i,j,k)=A,but matlab gives error....
How can I seperate A matrix for each step?

thanks.....

Subject: matrix

From: Steven Lord

Date: 4 Nov, 2009 14:13:13

Message: 2 of 5


"Handan Yaslan" <hyaslan.nospam@mathworks.com> wrote in message
news:hcs07k$kd7$1@fred.mathworks.com...
> Hi
> I obtained the matrix A using a lot of calcultation in the for,
> for i=1:N
> for j=1:N
> for k=1:N
> (I did a lot of calcultation ,so I obtained the matrix A )
> A
> end
> end
> end
>
> Main problem;
> for every each step I want to see A matrix. For example
> i=1 j=1,k=1 what is A?
> i=1,j=1,k=2, A=?
> i=N j=N k=N A=?
>
> I tried B(i,j,k)=A,but matlab gives error....
> How can I seperate A matrix for each step?

The easiest way to do this is probably with a cell array:

C = cell(N,N,N);
% start the FOR loops
    % obtain A
    C{i, j, k} = A;
% end the FOR loops

C{2,3,4} % is A for i = 2, j = 3, k = 4.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: matrix

From: Sebastiaan

Date: 4 Nov, 2009 14:13:02

Message: 3 of 5

Hi!

I think your matrix has a different size for each (i,j,k), so you can use a cell array:
B{i,j,k} = A

(note the {} in stead of () ).

Sebastiaan

"Handan Yaslan" <hyaslan.nospam@mathworks.com> wrote in message <hcs07k$kd7$1@fred.mathworks.com>...
> Hi
> I obtained the matrix A using a lot of calcultation in the for,
> for i=1:N
> for j=1:N
> for k=1:N
> (I did a lot of calcultation ,so I obtained the matrix A )
> A
> end
> end
> end
>
> Main problem;
> for every each step I want to see A matrix. For example
> i=1 j=1,k=1 what is A?
> i=1,j=1,k=2, A=?
> i=N j=N k=N A=?
>
> I tried B(i,j,k)=A,but matlab gives error....
> How can I seperate A matrix for each step?
>
> thanks.....

Subject: matrix

From: Handan Yaslan

Date: 4 Nov, 2009 14:43:03

Message: 4 of 5

"Handan Yaslan" <hyaslan.nospam@mathworks.com> wrote in message <hcs07k$kd7$1@fred.mathworks.com>...
> Hi
> I obtained the matrix A using a lot of calcultation in the for,
> for i=1:N
> for j=1:N
> for k=1:N
> (I did a lot of calcultation ,so I obtained the matrix A )
> A
> end
> end
> end
>
> Main problem;
> for every each step I want to see A matrix. For example
> i=1 j=1,k=1 what is A?
> i=1,j=1,k=2, A=?
> i=N j=N k=N A=?
>
> I tried B(i,j,k)=A,but matlab gives error....
> How can I seperate A matrix for each step?
>
> thanks.....


thank you very much for your answers....
But now I have other problem. In my problem
for i=-N:N
   for j=-N:N
    for k=-N:N

C{i,j,k} is used for positive integer . I will try to solve this case...If you have some information would you write to me....

Subject: matrix

From: Matt Fig

Date: 4 Nov, 2009 16:40:18

Message: 5 of 5

One way to do something like this is to mimic manually the integer loop indices.


cnt_ii = 1;
cnt_jj = 1;

for ii = -.5:.1:.5
    for jj = -.9:.1:.9
        G{cnt_ii,cnt_jj} = rand;
        cnt_jj = cnt_jj + 1;
    end
    cnt_ii = cnt_ii + 1;
    cnt_jj = 1;
end

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com