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

Shivangi
Shivangi 2018년 1월 22일
편집: Walter Roberson 2018년 1월 22일
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 2018년 1월 22일
You have changed your code since your previous post, so I am not sure how you have created your values.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 21일

0 개 추천

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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2018년 1월 21일

댓글:

2018년 1월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by