I am executing matlab script ( converted into .sh file using mcc ) using exec command from php . exec("./run_searchIMage.sh <Matlab Path> > output file 2>&1 & ") .

Asked by Anirudh Goyal about 20 hours ago
Latest activity Commented on by Walter Roberson about 7 hours ago

Running this command from php is giving error Error Using imshow IMSHOW unable to display image.

But if I run ./run_searchImage.sh -path from the command line it is running fine.

Code snipet where it is giving error .

f1 = figure('Visible','off'); imshow(im1_);hold on; f=figure('Visible','off'); imshow(im2_); hold on;

0 Comments

Anirudh Goyal

Products

No products are associated with this question.

2 Answers

Answer by Anirudh Goyal about 13 hours ago
Accepted answer

Yes I mean to run it from php and probably there is no display environment variable set , so cld u plz elaborate your answer a little bit more

I have asked the same thing in apache mailing list and they told to run matlab in headless mode , and I tried running it but cld get the results , so cld u plz tell how to do it

0 Comments

Anirudh Goyal
Answer by Walter Roberson about 13 hours ago

When you run it from PHP there is probably no DISPLAY environment variable set.

When you say "run it from PHP" do you mean by a web server? If so then the web server session is not connected to any display, and so is not able to display graphics. The most it can do in such a case is to compute an image of a graphic and send the image to the web session using an appropriate MIME type.

5 Comments

Walter Roberson about 10 hours ago

What do you want the imshow() to do in your situation?

If your concern has to do with trying to run the same code in two different situations, then it is possible to code to detect the situation and have the imshow() not performed when there is no display. And if it is important that the code not be altered, then you can use your own routine named imshow.m that does the test and invokes the real imshow if there is a display.

If you are wanting the graphics generated by MATLAB to show up on the user's system, the you need to do like I discussed above (saveas etc). If that is not acceptable then you should be reconsidering whether you want this to be a web service, or if instead you want it to be handled by Terminal Server or Remote Desktop or VNC to provide "live" MATLAB sessions.

Anirudh Goyal about 9 hours ago

I want this to be an web app only But Now for demonstration purposes I have shown this using Remote Desktop. I am showing an Image using imshow then I am plotting some boundaries on it using plot and then I am saving this using saveas .

Walter Roberson about 7 hours ago

Try using image() or imagesc() instead of imshow()

Walter Roberson

Contact us