Info

# How to select a cell from an array when this array is made of functions of a parameter?

1 view (last 30 days)
Marlon Saveri Silva on 6 Jun 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Dear all,
Consider an array
A = [a(t) b(t) c(t)].';
I want to select b(t). However, when I enter "A(2)", MatLab returns
a(2)
b(2)
c(2)
b(t).
How could we select get b(t) in this case?
Thanks

Giorgos Papakonstantinou on 6 Jun 2015
You can do
A{2}
or
A{1,2}

Marlon Saveri Silva on 6 Jun 2015
Edited: Marlon Saveri Silva on 6 Jun 2015
Thanks. But MatLab returns this error:
Error using symfun/subsref (line 143)
Cell indexing and structure indexing are not implemented for symbolic functions.
This is my code:
clear
clc
%%Parameters
l = 12;
h = 0.9;
%%Coord. Systems
syms Alpha(t) Beta(t) Gama(t)
S_1_0=[ 1 0 0 ; 0 cos(Alpha) sin(Alpha) ; 0 -sin(Alpha) cos(Alpha)];
S_2_1=[ cos(Beta) 0 -sin(Beta) ; 0 1 0 ; sin(Beta) 0 cos(Beta)];
S_3_2=[ cos(Gama) sin(Gama) 0 ; -sin(Gama) cos(Gama) 0 ; 0 0 1];
S_3_0=S_3_2*S_2_1*S_1_0
%%Position, Veloc, Acc...
rc=l.*[sin(Gama) -cos(Gama) 0].' + S_3_0*[0 0 h].';
vc=fulldiff(rc,t);
ac=fulldiff(vc,t);
ac_y=ac{2}