"Error displaying value" in Workspace browser for user defined object

I have a user defined object that I implemented concatenation for. However once it is concatenated the value field in the Workspace browser says "Error Displaying Value". The object works as expected in the code and has the necessary fields:
whos('YM')
Name Size Bytes Class Attributes
YM 2x1 1822 DClab.ResponseModel
If anyone knows why this would be happening, I would really appreciate it.

 Accepted Answer

Isn't the message
Error using disp
Too many input arguments.
??
Which Matlab release?
--- Cont. ---
This behaves as expected (R20112a) and m is displayed correctly in the Workspace browser
n1 = node(1,2);
n2 = node(2,3);
m = [ n1, n2 ];
.
classdef node < handle
properties
x;
y;
bearing=0;
end % properties
methods
function this = node(x,y)
this.x=x;
this.y=y;
end%functions
end%methods
end %class
.
DClab is that a package?
.
--- Cont. ---
Moving node to a package folder causes no problems here.
.
--- Cont. ---
The error message is most likely generated by line 155 of the function, workspacefunc (R2012a). See the catch clause of the excerpt. I fail to reproduce the error; I leave it to you to find the exact behavior. It's no use that I guess. Thus
  1. put a break (dbstop) twenty lines before "catch err"
  2. run "workspacefunc( 'getshortvalue', DClab.ResponseModel )" in the command window
  3. step through the code. Hopefully the problem will surface.
  4. let the tech support know if the problem is not with your code.
Excerpt from the C:\Program Files\MATLAB\R2012a\toolbox\matlab\codetools\workspacefunc.m
% Copyright 1984-2011 The MathWorks, Inc.
.....
end
classinfo = [' ' getclass(var,true)];
retstr = ['<', theSize, classinfo, '>'];
end
catch err %#ok<NASGU>
retstr = getString(message( ...
'MATLAB:codetools:workspacefunc:ErrorDisplayingValue'));
end

1 Comment

Nope,
The error is inn the Workspace browser in the value field, it says "<Error displaying value>"
The disp command works fine:
disp(YM)
2x1 DClab.ResponseModel
Package: DClab
Properties:
type
name
model ...
It is Matlab 7.12.0 (R2011a)
Thanks
Chris

Sign in to comment.

More Answers (1)

DClab is a package we created. I tested with other objects in the package and it works fine. It only has the problem when it is concatenating a certain class (ResponseModel) of objects. All the objects in the package inherit from the same superclass as well, so I don't understand why the behavior would be different.
I also tested with your code to make sure that was working and it ran as expected. If you have any ideas I would appreciate it.
Thanks, Chris

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!