I wish to append my elem to the end of an array A.
What should I do?
22 Answers
Use the following
A = [A elem] % for row array or
A = [A; elem] % for col array Edit: Another simpler way is (as @BenVoigt suggested) to use end keyword
A(end+1) = elem; which works for both row and column vectors.
5Another way is
A(end+1) = elem; which works for both row and column vectors.
2