`% how to edit matrice A to matrice B with`

% A=[1 a b c

% 2 d e f

% 3 g h i];

% %

% B=[ 1 a b 0

% 2 b c 0

% 3 c a 0

% 4 d e 0

% 5 e f 0

% 6 f d 0

% ...

% 9 i g 0 ]

%% I have a code for this but it's not work

A=[1 a b c; 2 d e f; 3 g h i];[m,n]=size(A);B=zeros(3*m,n);for i=1:3*mB(i,1)=i;B(i,4)=0;endfor k=1:3for i=1:3:3*mB(i,2)=A(k,2);B(i,3)=A(k,3);endfor i=2:3:3*mB(i,2)=A(k,3);B(i,3)=A(k,4);endfor i=3:3:3*mB(i,2)=A(k,4);B(i,3)=A(k,2);endend B

# MATLAB: How to edit matrice to another matrice

image analysisMATLAB

###### Related Question

- How to access array elements in for loop
- How to put any variable name automatically
- I need a final equation… second….
- Add numerical array as column or in cell array
- I need help solving an ODE using the Runge Kutta method. The values I obtain for “A” are correct, but the value I receive for “C” are incorrect.
- I want to make several matrices from variables taken from user in a loop while performing some operation on them. I have attached a simplified code for the problem. So I want matrices from 1 to k but it is not working. Guide plz
- I want to save all the value of variable a from all iterations into a single matrix
- How to create a matrix for character-alphabets

## Best Answer