three dimensional arrays in matlab

Status
Not open for further replies.

ghasem_008

Full Member level 4
Joined
Feb 9, 2012
Messages
221
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
2,990
hi.I have a question.3D arrays in matlab how works?
I have a three-dimensional array in matlab.can anyone tell me that following code how work?

>>x=5;y=5;z=4;
>>a=ones(x+2,y+2,z+2);
>>b=a(2: x+2,2:y+2,2:z+2)-a(1: x,2:y+2,2:z+2);
>>c=find(b>0);

I have 2 questions:
1-what is b?and in other words,three dimensional arrays how work?
2-in line (4),what is output?what is returned to c?can anyone explain by a numerical example or give me a good reference?
thanks alot...
 
Last edited:


On the Matlab Command window type: help ones
This will explain what the function "ones" does

"a" is a 3D array of ones, note x+2= 7,y+2= 7,and z+2= 6
so "a" is a 7x7x6 array with all values = 1

"b" is an array that subtract a portion of "a" from "a" .

"c" should find all elements in "b" that are greater than 0. I have not used the function "find",
so not sure of what it will return. Type : help find

You can go to Matlabs website and learn about 3D arrays.
**broken link removed**[]=matlabcentral
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…