Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
can someone tell what is happening in here are we assigning values to an array or what?
조회 수: 1 (최근 30일)
이전 댓글 표시
out1(nx,:,1)=[nx x1(i,1,1) y(i,1,1)];
nx=nx+1;
댓글 수: 0
답변 (2개)
Thiago Henrique Gomes Lobato
2019년 9월 29일
In this case you are assigning a row vector to a row in matrix out1. One way to visualize this is using a very simple example:
First create a matrix and check the output
out1 = zeros(3,3,2);
x1 = ones(3,3,2);
y = ones(3,3,2)*2;
out1
out1(:,:,1) =
0 0 0
0 0 0
0 0 0
out1(:,:,2) =
0 0 0
0 0 0
0 0 0
Then do the assignment and check again the result:
nx = 3;
i = 1;
out1(nx,:,1)=[nx x1(i,1,1) y(i,1,1)]; %[3 1 2]
out1
out1(:,:,1) =
0 0 0
0 0 0
3 1 2
out1(:,:,2) =
0 0 0
0 0 0
0 0 0
here you can cleary see the assigment of a row array to a row of the matrix.
댓글 수: 0
KALYAN ACHARJYA
2019년 9월 29일
편집: KALYAN ACHARJYA
2019년 9월 29일
Is there any issue? I think no?
nx=nx+1; % nx updated with 1 and replace the present nx value
Following is the assigning out1 3D array
out1(nx,:,1);
Any specific issue, let me know here.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!