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
IAH public
DeProj
Commits
d1f1d1be
Commit
d1f1d1be
authored
Jul 17, 2020
by
Jean-Yves TINEVEZ
Browse files
Method to export results to csv or xslx.
parent
4430811e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/@deproj/deproj.m
View file @
d1f1d1be
...
...
@@ -23,6 +23,9 @@ classdef deproj
% Export masurements to a table.
T
=
to_table
(
obj
)
% Exports results to a spreadsheet file.
to_file
(
obj
,
file_name
,
include_header
)
%% Generate figures.
% Figure with the local plan orientation for a collection of epicells.
...
...
src/@deproj/to_file.m
0 → 100644
View file @
d1f1d1be
function
to_file
(
obj
,
file_name
,
include_header
)
%TO_FILE Exports results to a spreadsheet file.
% We include the variable units in the header.
if
nargin
<
3
include_header
=
true
;
end
T
=
obj
.
to_table
;
if
~
include_header
writetable
(
T
,
file_name
,
'WriteVariableNames'
,
false
);
return
end
% Add a first line with units.
[
n_rows
,
n_cols
]
=
size
(
T
);
header
=
cell
(
1
,
n_cols
);
T2
=
cell2table
(
cell
(
n_rows
+
1
,
n_cols
)
);
for
c
=
1
:
n_cols
units
=
T
.
Properties
.
VariableUnits
{
c
};
var_name
=
T
.
Properties
.
VariableNames
{
c
};
if
isempty
(
units
)
head
=
var_name
;
else
head
=
sprintf
(
'%s_(%s)'
,
var_name
,
units
);
end
header
{
1
,
c
}
=
head
;
end
T2
{
1
,
:
}
=
header
;
T2
{
2
:
end
,
:
}
=
table2cell
(
T
(
:
,
:
)
);
writetable
(
T2
,
file_name
,
'WriteVariableNames'
,
false
);
end
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