I have a huge matrix with more than 180 different symbolic variable. I need to change variables into vector form such from q1, q2 … to q(1), q(2)…
I wrote a code as below, I succided to change variable. But problem, now I lost my symbolic variables, when I query my variables with symvar(), I get empty results.
This is problem when I try to change from symbolic to function with matlabFunction() command. Naturally, it can not find any variable in my symbolic func.
Please help me
That is the result wtih symvar():
>> symvar(tests.test5.symbolicObsW{3,1})
ans =
Empty sym: 1-by-0
That is result with matlabFunction():
>> testRecords.funcObsw3 = matlabFunction(tests.test5.symbolicObsW{3,1});
Warning: Function 'sq' not verified to be a valid MATLAB function.
for cJ=1:6 tic; for t=NumRow ObsWsym{cJ,:}(t,:) = subs(regressors{cJ,1}(1,:), [q1, q2, q3, q4, q5, q6,... dq1, dq2, dq3, dq4, dq5, dq6,... ddq1, ddq2, ddq3, ddq4, ddq5, ddq6],... [sq(18*t-18+1), sq(18*t-18+2), sq(18*t-18+3),sq(18*t-18+4),sq(18*t-18+5),sq(18*t-18+6),... sq(18*t-18+7), sq(18*t-18+8), sq(18*t-18+9),sq(18*t-18+10),sq(18*t-18+11),sq(18*t-18+12),... sq(18*t-18+13), sq(18*t-18+14), sq(18*t-18+15),sq(18*t-18+16),sq(18*t-18+17),sq(18*t-18+18)]); %#ok<AGROW>
end disp(['Observation matrix (',... num2str(size(ObsWsym{cJ,1},1)),... 'X',num2str(size(ObsWsym{cJ,1},2))... ') for Joint ',num2str(cJ),' is generated by using Regressor']); toc;end
Best Answer