필터 지우기
필터 지우기

How to replace value with zero to match the size of array

조회 수: 1 (최근 30일)
Med Future
Med Future 2022년 3월 1일
답변: KSSV 2022년 3월 1일
Hello everyone, I hope you are doing well.
I have the dataset which is shape of 250x1000, i want to get only first 20 values from each row and replace all other value with zero
how can i do that in matlab

채택된 답변

KSSV
KSSV 2022년 3월 1일
Let A be your 250x1000 array.
B = zeros(size(A)) ; % initialize the zero matrix
B(:,1:20) = A(:,1:20) ; % replace first twenty values from each row

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by