フィルターのクリア

Error in READWRITE mode of matlab.io.fits.openfile

8 ビュー (過去 30 日間)
jvaillancourt
jvaillancourt 2024 年 1 月 3 日
回答済み: jvaillancourt 2024 年 1 月 5 日
I'm trying to read a FITS file in READWRITE mode but keep getting a "could not open file" error. I get no error in READONLY mode and the file reads correctly.
The code is simple: fptr = matlab.io.fits.openFile('filename.fits','readwrite')
The error is:
Error using matlab.internal.imagesci.fitsiolib
CFITSIO library error (104): could not open the named file
I get the same error when trying to read a file with an image HDU or with a binary-table HDU.
I've reset all the permissions on the file so that it is rwxrwxrwx (no ambiguity on what the permissions are) and get the same error. Any ideas about how to fix this?
Thank You.
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 1 月 3 日
Is the file in the current directory? Is it named exactly 'filename.fits' (not, for example, 'filename.FITS') ?

サインインしてコメントする。

回答 (3 件)

Dinesh
Dinesh 2024 年 1 月 4 日
Hello.
Ensure no other processes, including MATLAB instances, are accessing the "filename.fits" file, as this can prevent opening it in "readwrite" mode. Trying to open a different FITS file or creating a new one can help determine if the issue is file-specific or a broader permission issue.
If the problem still persists, ensure that the file is actually present in the relative path. Verify the file's directory permissions and the file system's write access once again. Also, check for typos and incorrect file extensions.

Ayush
Ayush 2024 年 1 月 4 日
編集済み: Ayush 2024 年 1 月 4 日
I understand that when you are trying to read a FITS file in READWRITE mode you are getting a "could not open file" error. I could reproduce the error when my filename consists of brackets () for R2022b release. However, this error seems to be fixed for R2023a release.
Check to see if your filename consists of some other such special characters. Rename the filename to remove such special characters.
Thanks,
Ayush

jvaillancourt
jvaillancourt 2024 年 1 月 5 日
Thanks for all the replies folks. The problem was not anything to do with the file name, or even permissions perhaps. And the problem did not occur on all FITS files (with similar data, names, and permissions). After re-starting MatLab several times the problem disappeared. I had one colleague who was able to re-produce the problem intermittently and another who never had any problems. ¯\_(ツ)_/¯

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by