Permalink
Browse files

Minor update to sendStruct to handle a potential error case

Previously, if you used a matrix or a column vector, sendStruct would
get an error on the m=double()  line. Now, we make sure that everything
is converted to a row vector prior to that line. We really shouldn't
put send matrices this way because the dimensionality is lost, but at
least the numbers get across correctly. But for column vectors, this is
fine and avoids the error.
  • Loading branch information...
1 parent 6c85709 commit fbe7a5621f4748caa7a8576a9803af3a03559340 @matadasm matadasm committed Apr 18, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 ex_control/sendStruct.m
View
@@ -9,7 +9,8 @@ function sendStruct(s)
fields = fieldnames(s);
for i = 1:length(fields)
- val = num2str(s.(fields{i}));
+ val = s.(fields{i});
+ val = num2str(val(:)'); % needs to be a row for the line below
m = double([fields{i} '=' val ';'])+256;
if params.sendingCodes

0 comments on commit fbe7a56

Please sign in to comment.