필터 지우기
필터 지우기

Add zero to make length divisible by 3

조회 수: 1 (최근 30일)
hdiba
hdiba 2016년 8월 6일
댓글: hdiba 2016년 8월 6일
Hallo,
i have vector that i want to reshape into a matrix. Therefor i firstly need to prove if the length is divisible by 3. if not i want to add as much zeros at the end of the vector until the length is divisible by 3? can someone help? thanks!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 6일
id=mod(-numel(A),3)
A(end+1:numel(A)+id)=0

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by