The 5th case should be: C_correct = cat(3,A(:,:,1)*B,A(:,:,2)*B,A(:,:,3)*B); ??
I gave the solution which passes all given test cases, but I am sure it will fail, if there are multiple combinations of sizes of A and B.
I believe, to get a full-proof solution, more test cases are needed. Or such solution can work for limited combination of sizes of multidimensional matrices to be multiplied.
José Ramón, You are absolutely right. I will fix it.
Have a look in 20b! :)
Project Euler: Problem 1, Multiples of 3 and 5
Back to basics 8 - Matrix Diagonals
Create a vector whose elements depend on the previous element
Remove entire row and column in the matrix containing the input values
Create an n-by-n null matrix and fill with ones certain positions
Robust alignment of coordinate system
Wayfinding 5 - Travel contour
Add a row of zeros on top of a matrix
Create a random vector of integers with given sum
Wayfinding 4 - Crossing, level 2
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office