Hi i have a question how to multiple this two
a=[10 11 15 18 20 40 50 66 88]
b=[10^1,10^2,10^3,10^4]
so that the answer is for example 10, 100 1000 10000 how can i write a code for the above thanks

 채택된 답변

Walter Roberson
Walter Roberson 2012년 5월 23일

0 개 추천

I suspect you want bsxfun() . Try
bsxfun(@times, a.', b)

추가 답변 (1개)

Andreas Goser
Andreas Goser 2012년 5월 23일

0 개 추천

"so that the answer is for example 10, 100 1000 10000"
b IS 10, 100 1000 10000 - you surely mix up something...
But in general, I suspect, that you look for a .* instead of a * operation.

댓글 수: 2

Walter Roberson
Walter Roberson 2012년 5월 23일
.* cannot be used when the number of elements is different.
Andreas Goser
Andreas Goser 2012년 5월 23일
Yes, but this is what users strugle with most (* vs. .*). And as the question is worded so confusing anyway, I was juts throwing out this idea ;-)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

Roh
2012년 5월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by