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 commentaires

Shivangi
Shivangi le 22 Jan 2018
Modifié(e) : Walter Roberson le 22 Jan 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.
Walter Roberson
Walter Roberson le 22 Jan 2018
You have changed your code since your previous post, so I am not sure how you have created your values.

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 21 Jan 2018

0 votes

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.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by