I'm trying to graph multiple sets of .csv data and display the max value for each data set on the graph itself. This has worked for all of my data sets except for one, which I keep getting the error "Error using horzcat Dimensions of matrices being concatenated are not consistent. The following is the code I've been using for two data sets, which I have attached to the post. TEK00055 is the one with errors and TEK00057 is the one without issues.
figure;tmd=load('TEK00055.CSV');x=5.+tmd(:,1);y=5.*tmd(:,2);plot(x,y)xlabel('Time (s)')ylabel('disp (mm)')indexmax = find(max(y) == y);xmax = x(indexmax);ymax = y(indexmax);strmax = ['Maximum = ',num2str(ymax)];text(xmax,ymax,strmax,'HorizontalAlignment','right');figure;tmd=load('TEK00057.CSV');x=5.+tmd(:,1);y=5.*tmd(:,2);plot(x,y)xlabel('Time (s)')ylabel('disp (mm)')indexmax = find(max(y) == y);xmax = x(indexmax);ymax = y(indexmax);strmax = ['Maximum = ',num2str(ymax)];text(xmax,ymax,strmax,'HorizontalAlignment','right');
For the TEK00057 data, a graph comes out exactly how I want, with the maximum y-value being labelled, but the TEK00055 data is giving me errors. From looking through the excel files, i can't find any major differences between the two. Any help would be appreciated.
Best Answer