Comparison between 3D maps
4 views (last 30 days)
Show older comments
Federico Paolucci on 23 Dec 2022
Commented: Federico Paolucci on 24 Dec 2022
Hello, I would like some advice on this: I have two 3D matrices A and B, 221x101x100 in size. They are matrices composed of elements 0 and 1 (they are binary matrices). I would like to make a comparison between the two matrices in the 4 cases
then, I have to plot the four cases with different colours. thanks for tha advice
Karim on 23 Dec 2022
Hello, you could use the scatter function to plot a sphere for the values that are true. Note, you need to use the ind2sub function if you want to obtain the 3D coordinates.
% set up random binary matrices...
A = rand(221,101,100) > 0.975;
B = rand(221,101,100) > 0.975;
% perform the comparison
A1B1 = A & B;
A0B1 = ~A & B;
A0B0 = ~A & ~B;
A1B0 = A & ~B;
% set up scatter points for 3D plot, using the indices as x,y,z values
[X,Y,Z] = ind2sub(size(A1B1),find(A1B1));
title('A = 1 & B = 1')
More Answers (0)
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!