## how to convert a 3-d binary array of spherical cordinates into floating type array of cartesian cordinates

### VANDANA GUPTA (view profile)

on 16 Oct 2019
Latest activity Commented on by Rik

on 25 Oct 2019

### Rik (view profile)

I have matlab data ("vand_sph61-11.mat") which i linked here. this data has spherical cordinates in binary form and has 3-d array. this data has 1801x59x109 size. 1801 is range by getting from dividing 5 meter to 50 meter into 2.5 cm. 59 is transmitter beams by getting from dividing -29 degree to 29 degree into 1 degree. 109 is receiver beams by getting from dividing -54 degree to 54 degree into 1 degree. I want to convert this data into cartesian cordinates which has floating type.
In this data, i created a 3-d object in which when point exist then have binary value '1' otherwise have binary value '0'.

Rik

### Rik (view profile)

on 16 Oct 2019
So you want to find the indices in your 3D array and convert those indices to the values of the three vectors you describe?
VANDANA GUPTA

on 16 Oct 2019
yes

### Rik (view profile)

on 16 Oct 2019

If you get my findND function from the FEX you can do this:
%find 3D indices in M
[r,c,p]=findND(M);
%create lookup tables
lookup=struct;
lookup.r=5:.025:50;
lookup.c=-29:29;
lookup.p=-54:54;
%convert indices to physical dimensions
r=lookup.r(r);
c=lookup.c(c);
p=lookup.p(p);

Rik

### Rik (view profile)

on 20 Oct 2019
fv=isosurface(M,0.5);
patch('Faces',fv.faces,'Vertices',fv.vertices,'FaceColor','b')
That way you don't even need findND. What you need to do is a way to find out how to convert the coordinate system of M (which is stored in the three columns of fv.vertices) to the coordinates you want your output to use.
Note that isosurface can take a long time and may generate a complex shape with too many polygons.
VANDANA GUPTA

### VANDANA GUPTA (view profile)

on 25 Oct 2019
sir , it is not working. it can't give exact figure
Rik

### Rik (view profile)

on 25 Oct 2019
'it is not working' does not provide any useful information. As I said in my comment these two lines of code are not enough to get your desired output. So what code did you try?