what is the form of the matrix B
Show older comments
A=[1 2 3 ;4 5 6; 7 8 9]
For i=1 size:(A,1)
For j=1 size:(A,2)
If j==1
B(i,j)=A(i,j);
else if j<i
B(i,j)=A(i,j)+1;
else if
B(i,j)=A(i,j)-1;
end
end
1 Comment
Jan
on 12 Sep 2013
Please format your code properly.
Answers (3)
Azzi Abdelmalek
on 11 Sep 2013
There some errors in your code
A=[1 2 3 ;4 5 6; 7 8 9]
for i=1:size(A,1)
for j=1:size(A,2)
if j==1
B(i,j)=A(i,j);
else if j<i
B(i,j)=A(i,j)+1;
else
B(i,j)=A(i,j)-1;
end
end
end
end
Walter Roberson
on 11 Sep 2013
0 votes
B is a 3 x 3 numeric matrix.
2 Comments
fanalrino
on 11 Sep 2013
Image Analyst
on 11 Sep 2013
After you view this short video http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/ you will learn how to find out.
Jan
on 12 Sep 2013
The answer
disp(B)
is such trivial, that I hesitate to believe that it solves the problem.
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!