-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguardarCSV.m
More file actions
executable file
·33 lines (33 loc) · 1.11 KB
/
Copy pathguardarCSV.m
File metadata and controls
executable file
·33 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function resultado=guardarCSV(nombreCompleto_csv,Datos)
[filas,columnas]=size(Datos);
fid=fopen(nombreCompleto_csv,'wt');
fprintf(fid,'%s\n','sep=|');
for i=1:filas
for j=1:columnas-1
if ~isnumeric(Datos{i,j}) && ...
~islogical(Datos{i,j})
fprintf(fid,'%s|',Datos{i,j});
elseif isnumeric(Datos{i,j}) && ...
~isscalar(Datos{i,j}) && ...
~islogical(Datos{i,j})
fprintf(fid,'%s|',Datos{i,j});
elseif isnumeric(Datos{i,j}) && ...
isscalar(Datos{i,j}) && ...
~islogical(Datos{i,j})
fprintf(fid,'%12.16G|',Datos{i,j});
elseif ~isnumeric(Datos{i,j}) && ...
isscalar(Datos{i,j}) && ...
islogical(Datos{i,j})
fprintf(fid,'%o|',Datos{i,j});
end
end
if isnumeric(Datos{i,columnas})
fprintf(fid,'%s\n',num2str(Datos{i,columnas}));
elseif ~isnumeric(Datos{i,columnas})
fprintf(fid,'%s\n',Datos{i,columnas});
end
end
output=fclose(fid);
exito=~logical(output);
resultado=exito;
end