Unzipping a gzipped string

조회 수: 1 (최근 30일)
Keith
Keith 2014년 10월 8일
댓글: Keith 2014년 10월 9일
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

채택된 답변

José-Luis
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
Keith
Keith 2014년 10월 9일
Thank you. That did the job I neeed.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Guillaume
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
  1. save your string to a file and use matlab gunzip. That's not going to be fast
  2. use java.util.zip.GZIPInputStream. May be a bit awkward. Certainly not a one-liner.

카테고리

Help CenterFile 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!

Translated by