Different results using .* on two computers
Show older comments
Hello
I am trying to run a MATLAB program, that my collegue wrote. It runs fine on his computer, however quite far down in the program i get an error using .* stating "matrix dimensions must agree". The operator is for multiplying a 1x1001 double with a 5x1001 double.
Any idea why it runs fine on his computer but not on mine? MATLAB versions are the same and the program initiates with: clc; clear all; close all; clear memory;format rational;
3 Comments
H ZETT M
on 7 Jun 2017
Are you sure that the matrices are the same ? I am also not sure how you want to multiply them. Since they are not the same size and it doesnt fit at all (at least from what I tested).
Have you also check if you call any functions in between ? Maybe one computer is using old files that you did not change
Adam
on 7 Jun 2017
Put a breakpoint in on his machine and see if the sizes of the arrays are the same as on yours.
Rik
on 7 Jun 2017
Try running it on the other computer and use a breakpoint to find out what sizes the variables are when he runs it.
Does it load data from somewhere that might be different between the machines? Are there helper functions on one computer, where the other computer uses a built-in with the same name? Those two are problems that I frequently encounter when debugging code.
Accepted Answer
More Answers (1)
Andrei Bobrov
on 7 Jun 2017
use
bsxfun(@times,a,b) % here a - double array [1 x 1001], b - double array [5 x 1001]
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!