I got it to work using this!
t =[];
for i = 1:22% there are 22 vector
j = int2str(i);
p = '/Response_Spec_Workflow_Main/Response_Spec_Workflow_Main_'; % This is the preceding part of the path that comes before the number I wish to iterate over.
k = '/FPV_Tri_Float_BM_10x/Initial/Dynamic/Floater_2/segment_1/node_4/Displacement in x - direction'; % Proceeding portion of path the path that comes after the number
s = strcat(p,j,k); %
r = h5read('C:\Users\..',s); % the file directory and s contains the path
t =[t,r,];
end
Because the number I wish to change for every iteration is in the middle of the path I have converted the number to a string then concatenated the first part of the path (string), then the number, then part which comes after (string),