Unzipping a gzipped string
1 次查看(过去 30 天)
显示 更早的评论
Hello, Currently, we are using PHP to read data from a gzipped, base 64 encoded database and outputting the results which is then read by Matlab and manipulated as needed.
I would like to read the database directly from Matlab. I have no problem reading the database and decoding from Base64. However, I cannot understand how to unzip (uncompress) the string.
In PHP, it is a simple function called 'gzuncompress'. However, in Matlab, the gzip function requires a file, not a string.
Any suggestions would be great. Thanks Keith
0 个评论
采纳的回答
José-Luis
2014-10-8
You could always call a PHP script from Matlab using the system() call and have it return the uncompressed string.
更多回答(1 个)
Guillaume
2014-10-8
Yes, there are several functions in matlab that are severely limited compared to other languages as they only work on files and not on streams / strings. Other than Jose-Luis' answer, you can
- save your string to a file and use matlab gunzip. That's not going to be fast
- use java.util.zip.GZIPInputStream. May be a bit awkward. Certainly not a one-liner.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!