I would like to loop the following script so that the 00001 will sequentially increase (to 00002, 00003 etc.) in the order 1 to 100. The 00001 appears 3 times:
Under %% Initialize variables: r5004b_00001.dat and under %% Allocate imported array to column variable names: Angle00001 and Intensity00001
%% Initialize variables.
filename = sprintf('E:\XRD\Enamel\r5004b_00001.dat');
startRow = 5;
%% Format string for each line of text:
formatSpec = '%14f%f%[^\n\r]';
%% Open the text file.
fileID = fopen(filename,'r');
%% Read columns of data according to format string.
dataArray = textscan(fileID, formatSpec, 'Delimiter', '', 'WhiteSpace', '', 'HeaderLines' ,startRow-1, 'ReturnOnError', false);
%% Close the text file.
fclose(fileID);
%% Allocate imported array to column variable names
Angle00001 = dataArray{:, 1};
Intensity00001 = dataArray{:, 2};
%% Clear temporary variables
clearvars filename startRow formatSpec fileID dataArray ans;