I have a vector (or array)
A = [2 3 4]
I want to replace all elements of each row with a scalar value of 4. I have the code:
for ii = 1: size(A, 1)
A(ii,:) = 4
end
This returns A = [4 4 4]
. How can i obtain a 1x1
matrix: A = [4]
rather than the 1x3
matrix?
Many thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…