Cyclothymia Posted July 17, 2008 Report Share Posted July 17, 2008 I have been struggling to get imread to work in MATLAB scripts. I have gotten the exact same lines of code to work both in the MATLAB Command Window from LabVIEW, and in MATLAB as well. I believe my variables (only one to output the resultant image array) have been named correctly. I have considered using Mathscript also (imread works in Mathscript with some modification to data types), but if imread works, I will need to call the GRAB function which uses cell arrays. Although I could have modified the code to avoid using cell arrays it would be a last resort. When running the vi I get the following error: ======================================================================== Error 1048 occurred at LabVIEW: LabVIEW failed to get variable from the script server. Server:"7.4.0.287 (R2007a) " in MATLABscripts.vi Possible reason(s): LabVIEW: LabVIEW failed to get variable from the script server. ======================================================================== I have looked up on knowledgebase information on the NI website, and also [HERE], to no avail. The version of LabVIEW I am using is 8.5, and for MATLAB 2007a. Any help would be appreciated. Quote Link to comment
Cyclothymia Posted August 7, 2008 Author Report Share Posted August 7, 2008 UPDATE: SOLVED I realized that this was due to a typecasting problem: MATLAB on its own has smart casting during function calls. When running the script in LABVIEW, which is strictly typed, the solution was to explicitly cast imread into double(): bar = double(imread("foo.jpg")); Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.