Trinity-SpaceData / conjunction /nasa_cara /DistributedMatlab /EphemerisPc /src /readFortranAsTable.m
Download conjunction/nasa_cara/DistributedMatlab/EphemerisPc/src/readFortranAsTable.m from STAR-future/Trinity-SpaceData: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/datasets/STAR-future/Trinity-SpaceData/resolve/main/conjunction/nasa_cara/DistributedMatlab/EphemerisPc/src/readFortranAsTable.m
- Command line
-
hf download hf://datasets/STAR-future/Trinity-SpaceData/conjunction/nasa_cara/DistributedMatlab/EphemerisPc/src/readFortranAsTable.m
-
curl -L -o readFortranAsTable.m https://huggingface.co/datasets/STAR-future/Trinity-SpaceData/resolve/main/conjunction/nasa_cara/DistributedMatlab/EphemerisPc/src/readFortranAsTable.m
2.1 kB
| function [A] = readFortranAsTable(fileName, numElems, formatSpec, colNames) | |
| % readFortranAsTable - Read a FORTRAN-produced data file into a Matlab | |
| % table. | |
| % | |
| % Syntax: A = readFortranAsTable(fileName, numElems, formatSpec, colNames); | |
| % | |
| % ========================================================================= | |
| % | |
| % Copyright (c) 2026 United States Government as represented by the | |
| % Administrator of the National Aeronautics and Space Administration. | |
| % All Rights Reserved. | |
| % | |
| % ========================================================================= | |
| % | |
| % Input: | |
| % | |
| % fileName - Path to FORTRAN data file | |
| % | |
| % numElems - Number of elements per row | |
| % | |
| % formatSpec - Format string for sscanf | |
| % | |
| % colNames - Column names for table {1xN} | |
| % | |
| % ========================================================================= | |
| % | |
| % Output: | |
| % | |
| % A - Matlab table with columns defined by colNames | |
| % | |
| % ========================================================================= | |
| % | |
| % Initial version: Feb 2024; Latest update: Apr 2026 | |
| % | |
| % ----------------- BEGIN CODE ----------------- | |
| fileData = fileread(fileName); | |
| fileData = strrep(fileData,'D','E'); | |
| sizeA = [numElems Inf]; | |
| A = sscanf(fileData,formatSpec,sizeA); | |
| A = array2table(A','VariableNames',colNames); | |
| end | |
| % ----------------- END OF CODE ------------------ | |
| % | |
| % Please record any changes to the software in the change history | |
| % shown below: | |
| % | |
| % ----------------- CHANGE HISTORY ------------------ | |
| % Developer | Date | Description | |
| % --------------------------------------------------- | |
| % D. Hall | 2024-Feb-26 | Initial version. | |
| % J. Halpin | 2026-Apr-22 | Added header and footer | |
| % ========================================================================= | |
| % | |
| % Copyright (c) 2026 United States Government as represented by the | |
| % Administrator of the National Aeronautics and Space Administration. | |
| % All Rights Reserved. | |
| % | |
| % ========================================================================= |