Hi Cian,
The error you're encountering suggests that, during the extraction process, MATLAB encounters a file within your .tar archive that it expects to be in GZIP format but isn't. This could be due to several reasons, including a corrupted file, or a file that's incorrectly named or has a misleading extension. Here are several steps and considerations to help you troubleshoot and resolve the issue:
- Verify file integrity: Ensure that none of the .tar.gz files are corrupted. You can use tools like gzip -t filename.tar.gz on Linux or macOS to test the integrity of the GZIP files. For Windows, tools like 7-Zip can verify the integrity of compressed files.
- Manual Test: Try manually extracting the files around the 50th file using external tools (e.g., 7-Zip, WinRAR, or the tar and gzip commands in a Unix-like terminal). This can help verify if the issue is with the file or with the extraction process.
- Use Lower-Level Functions: If untar and gunzip consistently fail, consider manually managing the extraction process using MATLAB's lower-level file I/O functions. This approach is more complex and requires a good understanding of the GZIP and TAR file formats.
- Temporary Directory: The error message suggests MATLAB is writing to a "TempGz" directory. Ensure this directory is not filling up or encountering permissions issues partway through your extraction process.
Given the repetitive nature of the task and the consistent failure point, it's likely an issue with how a specific file is being interpreted by extraction functions, or a resource/environmental limitation encountered during the process.
Hope this helps.