I answered my own question. The code is below for anyone that is ever going to reference this. It also splits it into two figures depending on the specimen number. That way there isn't one overcrowded figure.
N=1; %Starts the for loop/ allows it to increase/match the specimen number
legendtext1=''; %creates a character so an array of each specimen number can be created for the legend
legendtext2='';
for A= N:9
[A]=find(bayonetdata==N); %Creates matrix that will match the specimen number only
if N>=5
hold on
figure(2)
plot(1:length(A),bayonetdata([A(1):A(end)]',2))
grid on
legendtext2= [legendtext2; num2str(N)]; % creates the matrix for the plot legend numbering
end
if N<5
hold on
figure(1)
plot(1:length(A),bayonetdata([A(1):A(end)]',2)) %plots the specimen number only test forces
legendtext1= [legendtext1; num2str(N)]; % creates the matrix for the plot legend numbering
grid on
end
hold off
N= N+1 ;
end
finallegend1=strcat(string('Bayonet '),legendtext1); %converts the legend to a string so that it can be manipulated easier within the legend and look cleaner
finallegend2=strcat(string('Bayonet '),legendtext2); %converts the legend to a string so that it can be manipulated easier within the legend and look cleaner
figure(1)
xlabel('Test Run')
ylabel('Ejection Force (kgf)')
grid on
title('Bayonet degredation over repeated housing ejections')
legend(finallegend1)
figure(2)
xlabel('Test Run')
ylabel('Ejecetion Force (kgf)')
grid on
title('Bayonet degredation over repeated housing ejections')
legend(finallegend2)