how will this code take input in matrix form for scaler multiplication??
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
function b =check(Q)
Q(3:2)=zeros(3,2);
Qmd2=Q(3:2);
disp(Qmd2);
c=[1 2;1 3;1 4];
b=c.*Qmd2;
end
3 commentaires
John D'Errico
le 14 Mar 2017
I don't think anyone will have a clue, because it does some very strange things, that I think you don't understand either. For example, you use this:
Q(3:2)
in several places. I think you don't know what it does, because it does absolutely nothing, except that it will create an error where you use it.
In general, if Q is any scalar or matrix, then this line will cause an error, like this:
Q(3:2)=zeros(3,2)
In an assignment A(:) = B, the number of elements in A and B must be the same.
The problem is the construct 3:2 produces an empty array. I.e., one with no elements at all. You cannot then stuff an array with 6 elements into something of size zero.
So the code that you show does nothing. Asking us how it will work is useless, since it won't work at all.
Aimen Mujahid
le 14 Mar 2017
John D'Errico
le 14 Mar 2017
You are making no sense at all. Sorry. As I pointed out, the code you have shown cannot ever run at all, for any input. Since I have no idea what you want it to do, I cannot give an answer to a question about the code, or how to change it.
Réponses (0)
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!