Add zero to make length divisible by 3

1 次查看(过去 30 天)
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 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by