Processing graphics from C programme with MathLink
- To: mathgroup at smc.vnet.net
- Subject: [mg60759] Processing graphics from C programme with MathLink
- From: Robert Cussons <r.cussons at gsi.de>
- Date: Tue, 27 Sep 2005 04:15:08 -0400 (EDT)
- Organization: GSI Darmstadt
- Sender: owner-wri-mathgroup at wolfram.com
I have a C programme that reads data from a number of files and arranges them into a list for Mathematica to access and then plot, Mathematica then exports this plot as an .eps to ghostview. This works when I run the code direct from Mathematica, but now I have tried to transport the code into the C programme to fully automate the process and I cannot get it to work. As you can imagine, I have a number of set commands to produce the required tables. But I don't know how to check whether these are being processed correctly. The most puzzling thing is I don't know why, even if other things are wrong, why ghostview doesn't launch. Shown below is a section of code including the attempt to launch ghostview. I have been at this solidly for a few days now and would be very grateful for some help!! Thanks, Rob. MLINK lp; int pkt; MLEnvironment env; env = MLInitialize(NULL); if(env == NULL) { return 1; } lp = MLOpen(argc, argv); if(lp == NULL) { return 1; } MLPutFunction(lp, "EvaluatePacket", 1); MLPutFunction(lp, "ToExpression", 1); MLPutString(lp, "Put[Export[\"~fmd/program/Be7/AV18gamma-cp-wb-ls-ic/energylevels.eps\", Join[pllist, labels], Rule[PlotRange, All], Rule[FrameTicks, List[Automatic, Automatic, None, Automatic]], Rule[AxesLabel, List[\"\", \"Energy/MeV\"]], Rule[ImageSize, List[1000, 1000]]], \"!gv energylevels.eps &\"]"); while((pkt = MLNextPacket(lp)) && pkt != RETURNPKT) MLNewPacket(lp); MLNewPacket(lp); MLEndPacket(lp); MLClose(lp); MLDeinitialize(env);