I have a problem in the annexed excel file there are two tables, first table give the graph representing geological layers I need to get the second table with Matlab Code

2 ビュー (過去 30 日間)
I have a problem in the annexed excel file there are two tables, first table give the graph representing geological layers I need to get the second table with suitable Matlab code (I have R2014b version).
  3 件のコメント

サインインしてコメントする。

回答 (3 件)

Star Strider
Star Strider 2023 年 3 月 6 日
編集済み: Star Strider 2023 年 3 月 6 日
One approach —
C1 = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1315950/Salt%20Dome%20Interpretation.xlsx')
C1 = 218×22 cell array
{'xc' } {'gBt' } {'z1' } {'z2' } {'z3' } {'z4' } {'z5' } {'z6' } {'z7' } {'zb' } {1×1 missing} {1×1 missing} {'xc' } {'gBt' } {'z1' } {'z2' } {'z3' } {'z4' } {'z5' } {'z6' } {'z7' } {'zb' } {[ 0]} {1×1 missing} {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {1×1 missing} {1×1 missing} {[ 0]} {1×1 missing} {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {[ 2.4306]} {1×1 missing} {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {1×1 missing} {1×1 missing} {[ 2.4306]} {1×1 missing} {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {[ 4.8613]} {[ 25.3493]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[ 4.8613]} {[ 25.3493]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[ 7.2919]} {[ 25.3786]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[ 7.2919]} {[ 25.3786]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[ 9.7225]} {[ 25.4049]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[ 9.7225]} {[ 25.4049]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[12.1532]} {[ 25.4165]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[12.1532]} {[ 25.4165]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[14.5838]} {[ 25.4269]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[14.5838]} {[ 25.4269]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[17.0144]} {[ 25.4266]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[17.0144]} {[ 25.4266]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[19.4451]} {[ 25.4246]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[19.4451]} {[ 25.4246]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[21.8757]} {[ 25.4104]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[21.8757]} {[ 25.4104]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[24.3063]} {[ 25.3901]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[24.3063]} {[ 25.3901]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[26.7369]} {[ 25.3649]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[26.7369]} {[ 25.3649]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[29.1676]} {[ 25.3212]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[29.1676]} {[ 25.3212]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[31.5982]} {[ 25.2762]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {1×1 missing} {1×1 missing} {[31.5982]} {[ 25.2762]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} {[34.0288]} {[ 25.2126]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]} {1×1 missing} {1×1 missing} {[34.0288]} {[ 25.2126]} {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]}
nidx = find(cell2mat(cellfun(@ismissing,C1(5,:), 'Unif',0)));
Partition1 = cell2table(C1(2:end,1:nidx(1)-1), 'VariableNames',C1(1,1:nidx(1)-1))
Partition1 = 217×10 table
xc gBt z1 z2 z3 z4 z5 z6 z7 zb ______ ______ _______ __________ __________ __________ __________ __________ __________ __________ 0 NaN {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } 2.4306 NaN {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } 4.8613 25.349 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 7.2919 25.379 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 9.7225 25.405 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 12.153 25.417 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 14.584 25.427 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 17.014 25.427 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 19.445 25.425 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 21.876 25.41 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 24.306 25.39 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 26.737 25.365 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 29.168 25.321 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 31.598 25.276 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 34.029 25.213 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]} 36.459 25.145 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]}
Partition2 = cell2table(C1(2:end,nidx(2)+1:size(C1,2)), 'VariableNames',C1(1,1:nidx(1)-1))
Partition2 = 217×10 table
xc gBt z1 z2 z3 z4 z5 z6 z7 zb ______ ______ _______ __________ __________ __________ __________ __________ __________ __________ 0 NaN {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } 2.4306 NaN {'NaN'} {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } {'NaN' } 4.8613 25.349 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 7.2919 25.379 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 9.7225 25.405 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 12.153 25.417 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 14.584 25.427 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 17.014 25.427 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 19.445 25.425 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 21.876 25.41 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 24.306 25.39 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 26.737 25.365 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 29.168 25.321 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 31.598 25.276 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.2000]} {[5.1000]} {[ 6]} 34.029 25.213 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]} 36.459 25.145 {[ 0]} {[0.1000]} {[1.4000]} {[1.6000]} {[2.6000]} {[4.1000]} {[ 5]} {[5.9333]}
M1 = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1315950/Salt%20Dome%20Interpretation.xlsx')
M1 = 217×22
0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000
file = websave('Salt%20Dome%20Interpretation','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1315950/Salt%20Dome%20Interpretation.xlsx')
file = '/users/mss.system.JpTSWW/Salt%20Dome%20Interpretation.xlsx'
[Data,Text] = xlsread(file);
Data
Data = 201×22
0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 NaN NaN 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000
Text = Text(1,:)
Text = 1×22 cell array
{'xc'} {'gBt'} {'z1'} {'z2'} {'z3'} {'z4'} {'z5'} {'z6'} {'z7'} {'zb'} {0×0 char} {0×0 char} {'xc'} {'gBt'} {'z1'} {'z2'} {'z3'} {'z4'} {'z5'} {'z6'} {'z7'} {'zb'}
nidx = find(ismissing(Text))
nidx = 1×2
11 12
Data1 = Data(:,1:nidx(1)-1)
Data1 = 201×10
0 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000
Data2 = Data(:,nidx(2)+1:numel(Text))
Data2 = 201×10
0 NaN NaN NaN NaN NaN NaN NaN NaN NaN 2.4306 NaN NaN NaN NaN NaN NaN NaN NaN NaN 4.8613 25.3493 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 7.2919 25.3786 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 9.7225 25.4049 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 12.1532 25.4165 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 14.5838 25.4269 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 17.0144 25.4266 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 19.4451 25.4246 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000 21.8757 25.4104 0 0.1000 1.4000 1.6000 2.6000 4.2000 5.1000 6.0000
% Matrix1 = table2array(Partition1)
% writematrix()
.
  5 件のコメント
Star Strider
Star Strider 2023 年 3 月 6 日
There is no reason to use if, elseif, else here.
It is straightforward to separate these two matrices using matrix indexing, as I have demonstrated, using ismissing to determine where one sub-matrix ends and the other begins.
My code should be robust to similar Excel files that have the same general structure.
Star Strider
Star Strider 2023 年 3 月 7 日
@Moustafa Abedel Fattah — With respect to your edited Comment, I already provided both tables. I call them ‘Data1’ and ‘Data2’ however you cal call them whatever you want. My code should also work in R2014b, since it uses xlsread for compatibility.

サインインしてコメントする。


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 3 月 6 日
Here is the solution. readmatrix() is option 1 and xlsread() is option 2:
D = readmatrix('Salt Dome Interpretation.xlsx');
% D = xlsread('Salt Dome Interpretation.xlsx');
D(1:2,:) = []; % NaNs removed
D(:,11:12) = []; % NaNs removed
%%
D1 = D(:,3:10);
D2 = D(:, 13:20);
figure
plot(D(:,1), D1)
grid on
set(gca, 'YDir','reverse')
legend('z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7')
figure
plot(D(:,11), D2)
grid on
set(gca, 'YDir','reverse')
legend('z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7')
  6 件のコメント
Moustafa Abedel Fattah
Moustafa Abedel Fattah 2023 年 3 月 6 日
編集済み: Moustafa Abedel Fattah 2023 年 3 月 7 日
The min value for variables: z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7' are constant (flatting) in range of xc [228.47935834853: 320.84335427666], If-those conditions satisfied please do the requestd step to get the table 2
Moustafa Abedel Fattah
Moustafa Abedel Fattah 2023 年 3 月 9 日
%Please I will mention again in the following the problem to be solved :
%1- table 1 and the annexed graph representing a salt dome structure
A = xlsread('SoltDome_Graph1.xlsx');
%Define the Result Depths (Z or Big-z)
Z1=(A(:,3));
Z2=(A(:,4));
Z3=(A(:,5));
Z4=(A(:,6));
Z5=(A(:,7));
Z6=(A(:,8));
Z7=(A(:,9));
Z = [Z1, Z2, Z3, Z4, Z5, Z6, Z7] ; %if we plot (xc, Z) give graph 1
figure(1)
plot(xc, Z) %
hold on
grid on
set(gca, 'YDir','reverse')
xlabel('xc -axis of measuered Bouguer (km)');
ylabel('calculated Profile depths in (km)');
title('Interpretation of profile data using slab model')
% to get table 2 and graph 2 I have to modify table 1 as I tried as follows:
%(her I need to determine the range of area to be flatten
indx = find(Z1~=Z2);
LOF_Salt = xc((indx)); %to find the location
[nr, nc] =size (A);
Z1_salt=Z1;
%to get the replaced value 0.885714285714286 ~ 0.886 and define
% new Z as Z_salt as follows:
%Z2([82: 151])=0.886;
Z2_salt=Z2;
%Z3([82: 151])=0.0.886;
Z3_salt=Z3;
%Z4([82: 151])=0.886;
Z4_salt=Z4;
Z5([82: 151])=0.886;
Z5_salt=Z5;
Z6([1: end])=max(z6);
Z6([82: 151])=0.886;
Z6_salt=Z6;
Z7([1: end])=max(z7);
Z7_salt=Z7;
Z_salt =[Z1_salt Z2_salt Z3_salt Z4_salt Z5_salt Z6_salt Z7_salt];
figure (2)
figure(6)
plot(xc, Z_salt)
hold on
grid on
set(gca, 'YDir','reverse')
xlabel('xc -axis of measuered Bouguer (km)');
ylabel('calculated Profile depths in (km)');
title('Interpretation of profile data using slab model')
%%%%% I need to do the previous using If-statment****Thanks in advance%%%%

サインインしてコメントする。


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 3 月 6 日
If understood your explanations, here is how to collect the data from table to w.r.t xc range values and constant values of z1 .. to zb by computing their difference:
D = readmatrix('Salt Dome Interpretation.xlsx');
D(1:2,:) = []; % NaNs removed
D(:,11:12) = []; % NaNs removed
%
D1 = D(:,1:10);
D1(200:end,:)=[]; % NaNs removed
D2 = D(:, 11:20);
D2(200:end,:)=[]; % NaNs removed
figure(1)
plot(D1(:,1), D1(:,3:10))
grid on
set(gca, 'YDir','reverse')
legend({'z_1', 'z_2', 'z_3', 'z_4', 'z_5', 'z_6', 'z_7', 'z_b'}, 'Location','NE', 'NumColumns',2)
ylabel('z_1, z_2, ... z_b')
xlabel('x_c')
xc = D2(:,1);
INDEX =xc>=228.47935834853 & xc<= 320.84335427666;
DD2 = D2(INDEX,:);
% Find constant values of z1 ... zb using diff()
Dz1 = diff(DD2(:,3)); ind_z1 = Dz1==0;
Dz2 = diff(DD2(:,4)); ind_z2 = Dz2==0;
Dz3 = diff(DD2(:,5)); ind_z3 = Dz3==0;
Dz4 = diff(DD2(:,6)); ind_z4 = Dz4==0;
Dz5 = diff(DD2(:,7)); ind_z5 = Dz5==0;
Dz6 = diff(DD2(:,8)); ind_z6 = Dz6==0;
Dz7 = diff(DD2(:,9)); ind_z7 = Dz7==0;
Dzb = diff(DD2(:,10)); ind_zb = Dzb==0;
% Take out those values
z1=DD2(ind_z1,3);
z2=DD2(ind_z2,4);
z3=DD2(ind_z3,5);
z4=DD2(ind_z4,6);
z5=DD2(ind_z5,7);
z6=DD2(ind_z6,8);
z7=DD2(ind_z7,9);
zb=DD2(ind_zb,10);
% Take out the corresponding xc values for plateaued values of z1 to zb
xc1 = DD2(ind_z1,1);
xc2 = DD2(ind_z2,1);
xc3 = DD2(ind_z3,1);
xc4 = DD2(ind_z4,1);
xc5 = DD2(ind_z5,1);
xc6 = DD2(ind_z6,1);
xc7 = DD2(ind_z7,1);
xcb = DD2(ind_zb,1);
figure(2)
plot(xc1,z1, 'r*-'),
hold on
plot(xc2,z2, 'bd-')
plot(xc3,z3, 'gh--')
plot(xc4,z4, 'mp-.')
plot(xc5,z5, 'kd-')
plot(xc6,z6, 'm^--')
plot(xc7,z7, 'k>-.')
plot(xcb,zb, 'b-', 'linewidth', 2), grid on
grid on
ylabel('z_1, z_2, ... z_b')
xlabel('x_c')
set(gca, 'YDir','reverse')
legend({'z_1', 'z_2', 'z_3', 'z_4', 'z_5', 'z_6', 'z_7', 'z_b'}, 'Location','NE', 'NumColumns',2)
hold off
% The same figure as in Figure (2) but better scaled yy axis
figure(3)
yyaxis left
plot(xc1,z1, 'r*-'),
hold on
plot(xc2,z2, 'bd-')
plot(xc3,z3, 'gh--')
plot(xc4,z4, 'mp-.')
plot(xc5,z5, 'kd-')
plot(xc6,z6, 'm^--')
plot(xc7,z7, 'k>-.')
set(gca, 'YDir','reverse')
yyaxis right
plot(xcb,zb, 'b-', 'linewidth', 2), grid on
grid on
set(gca, 'YDir','reverse')
YC=gca;
YC.YColor='b';
legend({'z_1', 'z_2', 'z_3', 'z_4', 'z_5', 'z_6', 'z_7', 'z_b'}, 'Location','NE', 'NumColumns',2)
ylabel('z_b')
xlabel('x_c')
hold off

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by