Using system() to Run LibreOffice / soffice on OSX
1 次查看(过去 30 天)
显示 更早的评论
I'm running MATLAB 2013a on OSX and am attempting to convert a .xlsx file to a .pdf using MATLAB script. After determining that this couldn't be achieved using MATLAB alone, I downloaded LibreOffice to help me out. Running the following code in Mac Terminal works perfectly:
/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/dwm8/Desktop/ /Users/dwm8/Desktop/box_copy.xlsx
This code saves the file box_copy.xlsx as a .pdf on my desktop. However, when I try running the same code in MATLAB using system():
system('/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/dwm8/Desktop/ /Users/dwm8/Desktop/box_copy.xlsx')
the .pdf does not get saved, and I get the error
dyld: Library not loaded: @loader_path/libcurl.4.dylib
Referenced from: /Applications/LibreOffice.app/Contents/Frameworks/libvcllo.dylib
Reason: Incompatible library version: libvcllo.dylib requires version 8.0.0 or later, but libcurl.4.dylib provides version 7.0.0
/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/dwm8/Desktop/ /Users/dwm8/Desktop/box_copy.xlsx: Trace/breakpoint trap
Does anyone have a solution for this error? Thanks for the help!
0 个评论
采纳的回答
Walter Roberson
2015-10-5
You will need to set the environment variable DYLD_LIBRARY_PATH and possibly DYLD_FRAMEWORK_PATH as well, to point to different libraries. You can do that inside MATLAB by using setenv() before you system(), or you can do it on the command line that you system(). It also might work to unset DYLD_LIBRARY_PATH
system('unsetenv DYLD_LIBRARY_PATH; /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf:writer_pdf_Export --outdir /Users/dwm8/Desktop/ /Users/dwm8/Desktop/box_copy.xlsx')
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!