How to select different indices for each column in an array
이전 댓글 표시
I am currently start with an array
xOn = zeros(4,2)
and index matrix
xInd = [1,3;2,4];
I am executing the command
xOn((xInd(1,:):xInd(2,:)),:) = 1;
with the goal of getting xOn that looks like
1 0
1 0
0 1
0 1
Instead, xOn=
1 1
1 1
0 0
0 0
Is there a way to get the first result?
답변 (1개)
Adam Danz
2021년 1월 25일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Debug Code에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!