So I had saved .mat files from my 2 Matlab codes and now loading into a new Matlab File for a comparison plot!
But I am getting an error that it is an "unrecognized function or variable", when I can clearly see the variable in my workspace

All the files ae attached!!
clear all;close all;clc;% Comparison Plot
filenames = {'q_Theta_Y.mat','q_dot_Theta_Y.mat','q_Y_Theta.mat', 'q_dot_Y_Theta.mat',... 'q_ref.mat', 'q_ref_dot.mat', 'Time.mat',... 'E_pos_Theta_Y.mat','E_vel_Theta_Y.mat','E_pos_Y_Theta.mat', 'E_vel_Y_Theta.mat'}; for kk = 1:numel(filenames) load(filenames{kk})end%--------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%% Plot results %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------------------------------------------------------------------------- % Plot Comparison b/w q_ref1 and q1 (Position of Link 1)
set(figure,'Color','white') subplot(2,2,1) plot(Time,q_Theta_y(:,1),'b-',Time,q_ref(:,1),'k-.','LineWidth',2); grid on grid minor hold on plot(Time, q_Y_Theta(:,1), 'r-', Time,'LineWidth',2); axis tight title('Link 1: actual and reference trajectory', 'fontsize', 20); xlabel('$$t \, {\rm [s]}$$', 'interpreter','latex','fontsize', 20); ylabel('$$Position (m)$$', 'interpreter','latex', 'fontsize', 20); % xlim([0 t_net(length(t_net))]);
% ylim([-1.2 1.2]);
legend('$$q_1$$($$\Theta \cdot Y$$)', '$$q_{1,{\rm ref}}$$', '$$q_1$$($$Y \cdot \Theta$$)',... 'interpreter','latex','fontsize',25); hold off
Best Answer