필터 지우기
필터 지우기

How to check for a zero in any row of a particular column in an [50000, 50000]?

조회 수: 2 (최근 30일)
Devika Waghela
Devika Waghela 2021년 4월 27일
답변: DGM 2021년 4월 27일
So I have an array of [50000, 50000] full of zeros. I gradually add elements to it by replacing the zeros with the elements. I want to add elements to a randomly picked column such that the element is placed at a lowest position of row available with zero.

답변 (1개)

DGM
DGM 2021년 4월 27일
Depends what you mean by "lowest position of row".
Consider the example:
firstzerorow = find(A(:,thiscolumn)==0,1,'first');
A(firstzerorow,thiscolumn) = mynumber;
or
lastzerorow = find(A(:,thiscolumn)==0,1,'last');
A(lastzerorow,thiscolumn) = mynumber;

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by