Hi there,
I created a function called Fx which takes an single number as input and produce a 1 single number as output.
I tried to run:
What I expected is an array of r 1x10, each contains the result of Fx of n from 1 to 10.
However, I got "Matrix dimensions must agree" instead. This does not make sense to me. I tried to run it with for loop and it worked just fine.
for n = 1:10
r(n) = Fxl(n);
end
The array involved in the calculation of Fx is 115824. So I tried with array n of 1x115824 then the code only return the result of n(1,1) only.
Does anyone know what's going on here?
If so, please let me know.
Thank you
9 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934259
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934259
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934262
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934262
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934283
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934283
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934286
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934286
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934295
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934295
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934301
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934301
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934307
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934307
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934316
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934316
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934319
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/564002-matrix-dimension-must-agree-vectorization#comment_934319
Sign in to comment.