I have a rather large .txt file (attached is an abbreviated version), there are about 500 cycles in the full file. Column 1(Var1) is the row count which is not always consistent, meaning sometimes it ends the cycle at the same row count, and other times it is different.
I used the text indicator on Var28, to split the table into 'Extend' and 'Retract' cells and then removed the Var28 string to make plotting easier. I need to plot each cycle Extend and Retract and find the min/max values and compare them with a specific value to see if they are in tolerance.
My question is, is there an easier way to do this rather than what I have started to do…? Matlab version: 9.2.0.556344 (R2017a)
% Test Run
clcclear%% Import Data
T = readtable('TestFileData.txt');T(:,28) = [];%% Split table using mat2cell
V = [8 6 9];C = mat2cell(T,V,size(T,2));% C{:,:} % to get all of the data
% C{1,1} Gives the first table (8x28 table)
E1 = C{1,1};newE1 = table2array(E1); % convert table E1 to an array so we can plot
minVar17 = min(newE1(:,17));maxVar17 = max(newE1(:,17));% C{2,1} Gives the second table (6x28 table)
R1 = C{2,1};% C{3,1} Gives the third table (9x28)
E2 = C{3,1};%% Plot data
% Extend 1
x = newE1(:,2); % Column 2 i.e. time
yy1 = newE1(:,17); % Column 17
yy2 = newE1(:,18); % Column 18
plot(x,yy1,x,yy2)title('Var17/18')xlabel('Time(s)')ylabel('Pressure(psig)')grid onlegend('Var17','Var18','location','best')
I have added a PNG of the txt file I was using, right now I'm just using simulated data.
Best Answer