Different results using .* on two computers
이전 댓글 표시
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
H ZETT M
2017년 6월 7일
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
2017년 6월 7일
Put a breakpoint in on his machine and see if the sizes of the arrays are the same as on yours.
Rik
2017년 6월 7일
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.
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2017년 6월 7일
use
bsxfun(@times,a,b) % here a - double array [1 x 1001], b - double array [5 x 1001]
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!