フィルターのクリア

Help installing Cfitsio and Mfitsio

5 ビュー (過去 30 日間)
Ami Shirley
Ami Shirley 2013 年 3 月 24 日
編集済み: Sanchari 2024 年 7 月 26 日 5:55
I need to install cfitsio and mfitsio to run a program (on Windows) but I'm a novice so I've no idea how to go about this. I've downloaded the files but I don't know how to install them in Matlab. Any help would be lovely!

回答 (1 件)

Sanchari
Sanchari 2024 年 7 月 26 日 4:34
編集済み: Sanchari 2024 年 7 月 26 日 5:55
Hello Ami,
Installing "cfitsio" and "mfitsio" to run a program in MATLAB on Windows involves a few steps. Here's a detailed guide to help through the process:
Step 1: Download "cfitsio" and "mfitsio"
  • cfitsio: Download the "cfitsio" library from the NASA HEASARC website: CFITSIO - Download. Extract the downloaded files to a directory on the computer.
  • mfitsio: Download the "mfitsio" package from MATLAB Central File Exchange or another source where it is available. Extract the downloaded files to a directory on the computer.
Step 2: Install "cfitsio"
  • Build "cfitsio": Open a terminal (Command Prompt) and navigate to the directory where "cfitsio" was extracted. Follow the instructions in the "README" or "INSTALL" file to build the library. Typically, the command would look like:
nmake -f Makefile.vc
Ensure that the built library files (e.g., "cfitsio.dll", "cfitsio.lib") are available in the directory.
  • Set Environment Variables: Add the directory containing "cfitsio.dll" to the system's "PATH" environment variable. Right-click on "This PC" or "Computer" on the desktop or in File Explorer. Select "Properties" > "Advanced system settings" > "Environment Variables". In the "System variables" section, find and select the "Path" variable, then click "Edit". Add the path to the directory containing "cfitsio.dll" and click "OK".
Step 3: Install "mfitsio"
  • Add "mfitsio" to MATLAB Path: Open MATLAB. Navigate to the directory where "mfitsio" was extracted using the "cd" command, or use the MATLAB GUI to set the current folder. Add the "mfitsio" folder to the MATLAB path using the "addpath" function:
addpath('C:\path\to\mfitsio');
savepath;
  • Compile mfitsio MEX Files: In MATLAB, navigate to the "mfitsio" directory. Run the "make" script provided with "mfitsio" to compile the ".MEX" files. This script will typically look for the "cfitsio" library and compile the necessary MEX files.
make
  • If the "make" script is not available, a manual compile of the MEX files using the "mex" command might be required. For example:
mex -I'C:\path\to\cfitsio\include' -L'C:\path\to\cfitsio\lib' -lcfitsio mfitsio.c
Step 4: Verify Installation
  • Test the installation: Run a simple test to ensure that "cfitsio" and "mfitsio" are correctly installed and working. Use a sample ".FITS" file to test reading and writing operations. For example:
fitsfile = 'sample.fits';
info = fitsinfo(fitsfile);
disp(info);
If the commands execute without errors and display the correct information, the installation is successful.
Following troubleshooting steps can also be performed if required:
  • Ensure Paths are Correct: Double-check that the paths to "cfitsio" and "mfitsio" are correctly set and that the required files are accessible.
  • Check MATLAB Compatibility: Ensure that the versions of "cfitsio", "mfitsio", and MATLAB are compatible with each other.
  • Compiler Configuration: Ensure that a compatible C compiler is configured for MATLAB. One can check and set up the compiler using the "mex -setup" command in MATLAB.
Hope this helps!

カテゴリ

Help Center および File ExchangeIntroduction 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