Creating geometries in matlab

Hello all, I want to create a mesh-grid and then assign properties to few of the blocks (4 here ) as in the figure attached. Is it possible to do all these things in MATLAB, and can somebody help me with the commands required for this process.

2 Commenti

Shivangi
Shivangi il 22 Gen 2018
Modificato: Walter Roberson il 22 Gen 2018
Thanks for your response
After using vol3d I am getting an output like this
I put a condition as given below.
if (((X_mid(cell)==2.5)&&(Y_mid(cell)==2.5)&&(Z_mid(cell)==2.5)))
A(i,j,k)= 1;
else if (((X_mid(cell)==5.5)&&(Y_mid(cell)==5.5)&&(Z_mid(cell)==5.5)))
A(i,j,k)= 4;
else A(i,j,k) = 0;
end
end
But these are not visible in the form of complete cube. Have I written code correctly? I want my results to be similar as in the above picture.
You have changed your code since your previous post, so I am not sure how you have created your values.

Accedi per commentare.

 Risposta accettata

Walter Roberson
Walter Roberson il 21 Gen 2018

0 voti

As I said in your other question on the same topic, you should be using vol3d v2 from the file exchange. Notice in the documentation:
In cases where voxels can be any RGB color, use: vol3d('CData', cdata); where cdata is an MxNxPx3 array, with RGB color along the 4th dimension. In cases where color and alpha values are highly independent, specify an MxNxP alphamatte as follows: vol3d('CData', cdata, 'Alpha', alpha);
So define a 3d alpha matrix that is 0 for each location where you have no data and 1 for each location you do have data.
Define a 4D matrix containing the color information. If it is easier for your purpose to define a 3d matrix with color index, then it not difficult to use that to index into a color map to produce a 4d matrix for vol3d purposes.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by