change columns in array to zeros and assign to another vector

조회 수: 1 (최근 30일)
Oday Shahadh
Oday Shahadh 2020년 6월 20일
댓글: KSSV 2020년 6월 20일
hi
I have a (n,3) array, I need to make the first and second coulmns zeros, and assign the resulted array to a new one
g=(a{1}(:,[1 2])==0);
tried this but not work

채택된 답변

KSSV
KSSV 2020년 6월 20일
n = 10 ;
A = rand(n,3) ; % matrix for demo
A(:,1:2) = 0 ; % make first two columns zero
B = A ; % assign tp B
  댓글 수: 3
Oday Shahadh
Oday Shahadh 2020년 6월 20일
v=cell(numel(a),1);
for i = 1:numel(a);
a{i}(:,1:2)=0;
v(i)=a{i};
end
not work
KSSV
KSSV 2020년 6월 20일
b = a ;
for i = 1:numel(a)
b{i}(:,1:2) = 0 ;
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by