Error when trying to suppress the output of vertcat

1 view (last 30 days)
Hello!
I've run into an odd error recently when trying to use vertcat. I have two matrices A and B, both of type 'double'; size(A) = 6713x1296 and size(B) = 10000x1296. I've repeatedly checked these sizes and they only differ in the number of rows. I want to vertically concatenate these. When I use vertcat or just [A;B] in the command line, it works just fine. I can also suppress the output using ;. But when this is executed in the main program, it only works if I don't suppress the output with ; (Both vertcat and [A;B] works if I don't suppress the output). If I do put a ; at the end of the statement, I get the error: Error using horzcat Dimensions of matrices being concatenated are not consistent.
Even though the dimensions clearly are consistent and all that is different is I decide to put a ; to suppress my output.
A little more info: The matrices A and B are essentially HoG features that I compute for positive and negative face images respectively using vl_hog. I compute these in two separate functions and return the values to the main program. My MATLAB version is R2014a. I've not had this issue with vertcat before. Even though it works if I don't suppress the output, it's just painful to wait for the entire 16713x1296 data values to print.
Thanks for helping!

Accepted Answer

Jan
Jan on 11 Nov 2015
This sounds magic. Whenever a magic problem has been described in the forum, the behavior was caused by another bug at an unexpected location.
Does the problem appear, while you use the debugger? Or if you disable the JIT:
feature('Accel', 'off');
feature('JIT', 'off');
So please set this code before the failing line:
whos('A', 'B');
size(A)
size(B)
  1 Comment
Lakshmi Nair
Lakshmi Nair on 11 Nov 2015
Thanks for your help! The behavior was indeed caused by a bug in the very next line where a horizontal concatenation was going wrong because of incorrect dimensions.

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!