# Question in matlab

• Jan 6th 2011, 01:48 AM
raed
Question in matlab
Hi All
I want to ask question on matlab
if we write the following statement in M-file

for i=1:10
for j=1:10
a(i,j)=input('a(i,j)=')
end
end
so the program print the following
a(i,j)=
a(i,j)=
.
.
.
.a(i,j)
now the question How can create a program print the following
a(1,1)
a(1,2)
..
.
.
.
a(10,10)

Best regard
• Jan 6th 2011, 02:03 AM
alexmahone
Quote:

Originally Posted by raed
Hi All
I want to ask question on matlab
if we write the following statement in M-file

for i=1:10
for j=1:10
a(i,j)=input('a(i,j)=')
end
end
so the program print the following
a(i,j)=
a(i,j)=
.
.
.
.a(i,j)
now the question How can create a program print the following
a(1,1)
a(1,2)
..
.
.
.
a(10,10)

Best regard

Code:

```for i=1:10   for j=1:10     a(i,j)   end end```
• Jan 6th 2011, 02:31 AM
raed
Quote:

Originally Posted by alexmahone
Code:

```for i=1:10   for j=1:10     a(i,j)   end end```

no, it is not walk .moreover, I must inter the value of a(i,j)
• Jan 6th 2011, 05:42 AM
CaptainBlack
Quote:

Originally Posted by raed
no, it is not walk .moreover, I must inter the value of a(i,j)

ss=[ 's(' , num2str(i) , num2str(j), ')' ];disp(ss);

CB
• Jan 8th 2011, 01:21 AM
raed
Quote:

Originally Posted by CaptainBlack
ss=[ 's(' , num2str(i) , num2str(j), ')' ];disp(ss);

CB

But this is print the following
a(11)
a(12)
.
.
.
.
a(1010)

it is good but can we print as the following:
a(1,1)
a(1,2)
.
.
a(10,10)

thank you?
• Jan 8th 2011, 04:07 AM
CaptainBlack
Quote:

Originally Posted by raed
But this is print the following
a(11)
a(12)
.
.
.
.
a(1010)

it is good but can we print as the following:
a(1,1)
a(1,2)
.
.
a(10,10)

thank you?

Look at the code, see what it does and why, then make the change that is needed to achieve the effect that you want.

It summarise, you have enough information to do what you want if you make the least bit of effort to understand what you have been shown.

CB