matrices converted problem into code
Show older comments
I am trying to convert the matrices A 3by 3, B randsample 3by3, C 3by2 converted into the code then run script, which always got wrong answer said undefined solution or invalid expression, check for missing or extra character. Can any one help me out with this? Best regard!
B = [1.8,2.8,0.3;randsample(0.1:0.1:0.9,1),-0.9,0.0;-0.1,1.0,2.3];
A = [5,-4,2;1,5,4;-6,-1,-3];
C = [3,6;4,-5;5,0];
ans1=B+A;
ans2=A*B;
ans3=B*A;
no 'ans4'
no 'ans5'
no 'ans6'
ans7=A*C;
ans8=5*(A+B);
ans9=A+B;
ans10=(5*A)+(5*B);
Answers (1)
Walter Roberson
on 26 Aug 2022
no 'ans4'
That would be a problem unless you happened to have defined a function no.m that accepted a character vector parameter.
Your code image has
ans4=
with nothing else on the end of the line. That is not valid syntax. If you want ans4 to exist but be empty, use either
ans4=[]
or
ans4=''
Categories
Find more on Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!