Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gyacomo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Cyril David Hoffmann
Gyacomo
Commits
47685529
Commit
47685529
authored
1 year ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
script to read fort.42 stream
parent
b4ff4118
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wk/read_fort42.m
+34
-0
34 additions, 0 deletions
wk/read_fort42.m
with
34 additions
and
0 deletions
wk/read_fort42.m
0 → 100644
+
34
−
0
View file @
47685529
% Define the file path
file_path
=
[
resdir
,
'fort.42'
];
% Replace 'your_file.txt' with the actual file path
% Open the file for reading
fileID
=
fopen
(
file_path
,
'r'
);
% Check if the file was opened successfully
if
fileID
==
-
1
error
(
'Failed to open the file.'
);
end
% Initialize an empty array to store the data
data__
=
[];
% Read the data from the file line by line
while
~
feof
(
fileID
)
% Read a line from the file
line
=
fgetl
(
fileID
);
% Convert the line to a numeric value and append it to the data array
value
=
str2double
(
line
);
% Check if the conversion was successful
if
~
isnan
(
value
)
data__
=
[
data__
;
value
];
end
end
% Close the file
fclose
(
fileID
);
% Display the stored data
figure
;
plot
(
data__
,
'o'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment