2

I thought a Makefile was just executing the stated shell commands, but things seem not that simple : sample.m is a minimal matlab program that displays a word on screen. When launched from a Makefile, it does not behave the same as when launched from the shell...

From the shell

alex:~$ matlab -nosplash -nodisplay -r "sample"

-> Displays the word correctly

From a Makefile

all :  
matlab -nosplash -nodisplay -r "sample"  

alex:~$ make

-> Displays the word with a blue bounding box

How can it be different ? I'm using Matlab 2010a on a Ubuntu 10.04 machine. No arguments are passed to the sample.m script.

alxpublic
  • 169
  • 1
  • 7
  • I don't have Matlab to play with, but I can suggest a long shot: could it be that there is more than one version of Matlab on your machine? Instead of `matlab ...`, try `which matlab` and see if they agree. Also, please post `sample` (the simplest version that gives the behavior). – Beta Feb 07 '11 at 21:24
  • I am not able to reproduce this. I am on Fedora 12, Matlab Version 7.9.0.529 (R2009b) 32-bit – Ghaul Feb 07 '11 at 21:30
  • @Beta : Only one version of matlab. which matlab => usr/bin/matlab. sample.m is as follows : ScreenNumber=0; [win, winRect]=Screen('OpenWindow', ScreenNumber); DrawFormattedText(win, 'Hello world', 'center', 'center', [127 127 127]); Screen('Flip', win); KbWait([],3); Screen('CloseAll'); – alxpublic Feb 08 '11 at 14:10

1 Answers1

0

Did you make sure you quit Matlab after running the script?

The Matlab console will linger in memory, invisible when run from make, and some resources will remain locked.

try this in your Makefile:

matlab -nosplash -nodisplay -r "sample; exit"

I tested sample.m and it works here.

towolf
  • 350
  • 1
  • 6