-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete cell_del_empty.m, char_to_logical.m, isexist_var.m, split_dir.m; Rename split_path.m --> del_separator.m
- Loading branch information
1 parent
cddd505
commit cb1e7b6
Showing
87 changed files
with
414 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,49 @@ | ||
function read_GMT_to_cst(fin, fout, varargin) | ||
% ================================================================================================================= | ||
% discription: | ||
% Transform GMT/ACSII Coastline data imported by GEODAS to SMS's cst format | ||
% 将GEODAS导入的GMT/ACSII岸线数据转换为SMS的cst格式 | ||
% ================================================================================================================= | ||
% parameter: | ||
% Parameter: | ||
% fin: input file || required: True || type: string || format: 'D:\data\coastline.dat' | ||
% fout: output file || required: True || type: string || format: 'D:\data\coastline.cst' | ||
% ================================================================================================================= | ||
% example: | ||
% GMT2cst('D:\data\coastline.dat','D:\data\coastline.cst') | ||
% ================================================================================================================= | ||
% History: | ||
% Update: | ||
% 2023-10-17: Created, by Zetao WU; | ||
% 2023-10-18: Modified to a function, by Christmas; | ||
% ================================================================================================================= | ||
% Example: | ||
% GMT2cst('D:\data\coastline.dat','D:\data\coastline.cst') | ||
% ================================================================================================================= | ||
|
||
|
||
data = readmatrix(strcat(fin)); | ||
[row,~] = find(isnan(data(:,1))); | ||
temp = []; | ||
dd = row(1)-1; | ||
temp = [temp;dd]; | ||
for i = 2:length(row) | ||
dd = row(i)-row(i-1)-1; | ||
data = readmatrix(strcat(fin)); | ||
[row,~] = find(isnan(data(:,1))); | ||
temp = []; | ||
dd = row(1)-1; | ||
temp = [temp;dd]; | ||
end | ||
dd = length(data)-row(length(row)); | ||
temp = [temp;dd]; | ||
data(row,:) = [];%删除nan | ||
fidID=fopen(strcat(fout),'w');%建立文件 | ||
%写入头文件 | ||
fprintf(fidID,'%s\n','COAST'); | ||
fprintf(fidID,'%i\n',length(temp)); | ||
%写入第一个岸线 | ||
fprintf(fidID,'%i %i\n',temp(1),0); | ||
for j = 1:temp(1) | ||
fprintf(fidID,'%i %i\n',data(j,:)); | ||
end | ||
% 循环写入中间岸线 | ||
for i=2:length(temp) | ||
fprintf(fidID,'%i %i\n',temp(i),0);% 保存 | ||
for j = 1:temp(i) | ||
ad = sum(temp(1:i-1)); | ||
fprintf(fidID,'%i %i\n',data(ad+j,:)); | ||
for i = 2:length(row) | ||
dd = row(i)-row(i-1)-1; | ||
temp = [temp;dd]; | ||
end | ||
end | ||
fclose(fidID); | ||
dd = length(data)-row(length(row)); | ||
temp = [temp;dd]; | ||
data(row,:) = [];%删除nan | ||
fidID=fopen(strcat(fout),'w');%建立文件 | ||
%写入头文件 | ||
fprintf(fidID,'%s\n','COAST'); | ||
fprintf(fidID,'%i\n',length(temp)); | ||
%写入第一个岸线 | ||
fprintf(fidID,'%i %i\n',temp(1),0); | ||
for j = 1:temp(1) | ||
fprintf(fidID,'%i %i\n',data(j,:)); | ||
end | ||
% 循环写入中间岸线 | ||
for i=2:length(temp) | ||
fprintf(fidID,'%i %i\n',temp(i),0);% 保存 | ||
for j = 1:temp(i) | ||
ad = sum(temp(1:i-1)); | ||
fprintf(fidID,'%i %i\n',data(ad+j,:)); | ||
end | ||
end | ||
fclose(fidID); | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.