Passing Arrays to a SubFunction
2 views (last 30 days)
Show older comments
N = 20;
B = 3;
maxNum = 10;
xyz = zeros(N,B); % 20 x 3 % Current Run Array
xyz = maxNum * rand(N,3); % 20 x 3 % Random (x,y,z) positions
mySubFunct(xyz);
...
...
% Sub-Function - mySubFunct(inArray)
mySubFunct(inArray);
c = [0.0, 0.0, 0;...
0.0, 5.0, 0;...
0.0, 10.0, 0;...
5.0, 0.0, 0;...
5.0, 10.0, 0;...
10.0, 0.0, 0;...
10.0, 5.0, 0;...
10.0, 10.0, 0];
% 20x3 + 8x3 = 28x3
% Current Array + corners
abc = vertcat(inArray, c);
xs = abc(:,1);
ys = abc(:,2);
zs = abc(:,3);
abc = vertcat(inArray, c);
xs = abc(:,1);
ys = abc(:,2);
zs = abc(:,3);
plot3(xs,ys,zs,'.','MarkerSize',10);
ERROR:
Undefined function or variable 'mySubFunct'.
Error in myHomework (line 71)
mySubFunct();
What am I missing or doing wrong???
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!