How to display a particular row of a matrix using loop
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ASHA RANI
el 22 de Jul. de 2020
x = [0:10:90]*pi/180;
x assumes 10 values.
After some codes, not giving here I have a matrix AR of size 8 x 10 complex double.Here 10 columns in AR correspond to x.
AR looks like this
Columns 1 through 6
-0.7907 - 0.0715i -0.9790 + 0.0019i -1.0042 + 0.0097i -0.2129 - 0.0251i 0.2552 + 0.0330i -1.4969 + 0.0031i
-2.5799 + 1.6142i 0.2074 - 0.0561i 9.9110 - 0.2609i -3.5511 - 0.0974i -21.2789 - 0.0706i 1.5682 + 0.0124i
-5.0430 + 3.5473i -3.4284 + 0.1915i -11.5629 + 0.3133i 2.1664 + 0.0879i 11.8606 - 0.0985i -0.0417 - 0.0234i
-0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 + 0.0000i -0.0000 - 0.0000i 0.0000 - 0.0000i
0.0184 + 0.0453i 0.1697 - 0.0032i 0.3204 - 0.0054i 0.1289 - 0.0000i 0.3203 - 0.0216i 0.3298 - 0.0100i
-2.2066 + 1.2603i 0.3310 - 0.0068i -0.0718 + 0.0024i -0.0427 - 0.0013i -0.7890 - 0.1629i 0.1793 - 0.0014i
-5.2254 + 3.7843i -3.7008 + 0.1472i -1.9046 + 0.0651i -0.6838 - 0.0333i -7.6944 + 0.0484i 0.5205 + 0.0034i
0.0000 + 0.0000i -0.0000 + 0.0000i -0.0000 + 0.0000i -0.0000 - 0.0000i 0.0000 + 0.0000i -0.0000 + 0.0000i
Columns 7 through 10
0.0047 + 0.0058i -0.1811 + 0.0005i 0.4990 + 0.0020i NaN + NaNi
2.6128 + 0.0132i 4.4093 + 0.0143i 12.9729 + 0.1027i NaN + NaNi
-1.8643 - 0.0154i -2.1497 - 0.0076i -4.2649 + 0.0165i NaN + NaNi
-0.0000 - 0.0000i 0.0000 - 0.0000i -0.0000 - 0.0000i NaN + NaNi
-0.3435 - 0.0048i -1.4333 - 0.0049i -1.6707 - 0.0107i NaN + NaNi
0.0932 - 0.0007i -0.0587 - 0.0002i -0.0572 - 0.0019i NaN + NaNi
2.0034 + 0.0091i 4.5705 + 0.0122i 11.9349 + 0.1339i NaN + NaNi
0.0000 + 0.0000i -0.0000 + 0.0000i 0.0000 + 0.0000i NaN + NaNi
I want to extract each row of AR which comes a 1 x 10 size. what loops i will use here.
I am using this codes, but it gives wrong answer.
for ii = 1:numel(x)
for i=1:8;
Z(i)=abs(AR(i,ii));
end
end
What is wrong in above codes. I want to exract each rows of AR separtely.
3 comentarios
Arthur Roué
el 22 de Jul. de 2020
What are you trying to do ? Do you want to compute the absolute value of each element in another matrix ?
Respuesta aceptada
madhan ravi
el 22 de Jul. de 2020
AR = num2cell(AR, 2);
celldisp(AR)
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!