Error when trying to suppress the output of vertcat

1 次查看(过去 30 天)
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!

采纳的回答

Jan
Jan 2015-11-11
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 个评论
Lakshmi Nair
Lakshmi Nair 2015-11-11
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by