Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Keerthi Nakkalil
gain_measurement
Commits
76700357
Commit
76700357
authored
Jan 11, 2021
by
Keerthi Nakkalil
Browse files
codes to extract the avr and rms of one .dat file
parent
9278c532
Changes
1
Hide whitespace changes
Inline
Side-by-side
noise_performance/avr.cpp
0 → 100644
View file @
76700357
void
avr
(){
std
::
ifstream
infile
(
"000/000_000.dat"
);
if
(
infile
.
is_open
()){
cout
<<
"The data file is opened..."
<<
std
::
endl
;
std
::
string
line
;
while
(
!
infile
.
eof
()){
std
::
getline
(
infile
,
line
);
if
(
line
.
rfind
(
"#"
,
0
)
!=
0
){
continue
;
}
cout
<<
"original line : "
<<
line
<<
std
::
endl
;
std
::
string
newline
=
" "
;
for
(
int
i
=
0
;
i
<
line
.
length
();
i
++
){
if
(
line
[
i
]
!=
':'
){
newline
=
newline
+
line
[
i
];
}
else
{
newline
=
newline
+
line
[
i
]
+
" "
;
}
}
cout
<<
"The new line with spaces "
<<
newline
<<
std
::
endl
;
std
::
stringstream
s
;
s
<<
newline
;
cout
<<
"The line is stored in the stringstream object..."
<<
std
::
endl
;
string
temp
;
double
num
;
while
(
!
s
.
eof
()){
s
>>
temp
;
if
(
std
::
stringstream
(
temp
)
>>
num
){
cout
<<
num
<<
std
::
endl
;
}
temp
=
" "
;
}
}
}
else
{
cout
<<
"Error..."
<<
std
::
endl
;
}
cout
<<
"done..."
<<
std
::
endl
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment