MATLAB: ADDING ZEROS to the front of array array May I ask for help I have two arrays like A=[ 111000 ] & B=[ 1111000 ] I would like to make A become [0111000],or for example if B=[101111000],A becomes[000111000]. Thank you Best Answer newA = [zeros(1, max(0, numel(B)-numel(A))), A] Related SolutionsMATLAB: How to make matrix of ones and zeros alternating depending on size and elements of an array % initializeiRow = [];jCol = [];% preallocateB = zeros((length(A)+1)/2,sum(A));% indices for columnsidx = [0; cumsum(A)]+1;for i = 1:length(A) if mod(i,2) ~= 0 iRow = [iRow; repmat((i+1)/2,A(i),1)]; jCol = [jCol; (idx(i):idx(i+1)-1).']; endendB(sub2ind(size(B),iRow,jCol)) = 1; MATLAB: Please help me create a sort function for hex strings https://www.mathworks.com/matlabcentral/answers/433934-how-to-pix-the-syntax-error#answer_350643 Related QuestionHow to Add two stringsHow can use “is not equal to” command in matlab? and how terminate or cancel if else?How to make vectors zero when adding two different size vectorsHow to speed up making large matrices, and reduce memory usageAdd column vector with for loops
Best Answer