delete 3D cell in pde geometry

9 views (last 30 days)
Ari Guo
Ari Guo on 11 Jul 2022
Answered: Nipun on 8 Nov 2023
The matlab version that i am using in 2022a. I want to make a suspended shape by delete on cell from a stack cells. My code is like below.
clear model;
dl=[2 2 2 2 2 2 2 2 2 2 2 2;
0 2 0 3 1 2 2 2 1 2 3 2;
2 0 0 3 1 2 2 2 2 3 2 1;
3 0 0 2 1 3 2 1 2 2 1 1;
3 0 3 1 2 2 1 0 2 2 1 1;
0 0 0 0 1 0 2 0 1 0 0 1;
1 1 1 2 3 1 3 1 3 2 2 3;];
model = createpde;
gm=geometryFromEdges(model,dl);
g3=extrude(gm,[1 1 1]);
subplot(sr,sc,1);
pdegplot(g3,'CellLabels','on');
if I want to delete cell 5, what should i do?

Answers (1)

Nipun
Nipun on 8 Nov 2023
Hi Ari,
I understand that you want to delete a specific cell in a given stack of cells in MATLAB. Based on the given information and code snippet, I assume that you want to do this operation on variable "dl".
You can use paranthesis "()" with specified row and column range to access a particular sub-matrix. Then, assign the range to an empty list (or matrix) to delete the range.
For instance, to delete the fifth row in dl, we can do the follwoing:
% dl(i,:) returns the ith row in dl with all its columns
dl(5,:) = []; % assign to empty structure
For more information on indexing MATLAB arrays and matrices, refer to this document: https://in.mathworks.com/help/matlab/math/array-indexing.html
Hope this helps.
Regards,
Nipun

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!