code running differently on 2 machines

3 views (last 30 days)
Hi,
I'm running code on 2 machines, 1 laptop and 1 desktop. I have an array that comes out of a loop, 'answer1', and the when I execute the code on each machine it comes out differently.
On the laptop the array is 120x1 and has values from 6.5211E-7 to 5.3847E-8. On the desktop the array is the same size bu is all zeros.
I have just noticed that several variables on the desktop version display many elements in the workspace pane, however the variables themselves do seem to contain numbers.
Anyone any ideas? I can attempt to upload code if needed.
Thanks.
  1 Comment
Jarrod Rivituso
Jarrod Rivituso on 21 Apr 2011
I would step through the code using the debugger to see where things start to go wrong, and then investigate from there. Sometimes, these things can be as easy as a missing file on one machine or another.

Sign in to comment.

Accepted Answer

William
William on 21 Apr 2011
You could look at several implementation issues for the source of your problem. I've listed a sequence of questions below that may be of help.
Are both machines the same processor? Same processor type x86 vs 64bit? Execute 'eps' on both machines to see what the smallest possible value is. If eps is different then rounding 'errors' may exist. Are you using the same Matlab version?
It is possible that different Matlab versions could include bug fixes.
If you don't control the machines someone may have replaced one of the functions you are using with a local directory or path copy with slightly altered output.
Does the function you are using depend upon random or seed values?
As an alternative to the debugger you could try the profile tool or look at intermediate output.

More Answers (0)

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!