I am running a very long and not well scripted code to plot trajectories a month at a time. I also also doing some pretty off the wall math to do different calculations.
My code works great for the entire year, until I get to Christmas, then I get the horzcat error messge.
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in Plot_7day_traj_Fullyear (line 1186)
t7Data = [t7Data C.data(:,9:12)];
I tracked the error to a problem between two files, but the files have the same number of rows and columns as they were generated in sequence by the same program at the same time.
Here is the entire code. The short version of it. I excluded months January-November as they work perfectly fine. Attached are the troublesome files. tdump86122418 is brought into t7Data. tdump86122500 is not. I would attach more, but there are 124 for December.
delimiterIn = ' ';
headerlinesIn = 12;
t7Data = [];
p7Data = [];
for i = 1337:1460
C = importdata(tdumpnames7DayTraj(i,2),delimiterIn,headerlinesIn);
t7Data = [t7Data C.data(:,9:12)];
p7Data = [p7Data C.data(:,9:13)];
end
I don't mean to be a pain, but if someone can find a difference between the two text files and explain why I am getting this message, I would appreciate it. Another odd quirk, if I change (:,9:12) to (:,anynumberlessthan9:12) it works fine. I thought about doing this, but it throws the scripts I have following it all out of wack.
As far as I can tell, it just appears for an unknown reason and then disappears. Not
2 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/438882-horzcat-dimensions-of-matrices-are-not-consistent-error-message-confusion#comment_658525
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/438882-horzcat-dimensions-of-matrices-are-not-consistent-error-message-confusion#comment_658525
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/438882-horzcat-dimensions-of-matrices-are-not-consistent-error-message-confusion#comment_658860
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/438882-horzcat-dimensions-of-matrices-are-not-consistent-error-message-confusion#comment_658860
Sign in to comment.