MATLAB Answers

Lukas
0

How to I disable truncation of long strings in structs in command window?

Asked by Lukas
on 9 Apr 2015
Latest activity Commented on by Thomas Koelen on 9 Apr 2015
Hello,
I am on Matlab R2014a (8.3.0.532, glnxa64). Whenever I have a long string as a struct member and let it display on the command window, I get a truncated version of it. How do I disable this "feature"?
Example:
>> myStruct.myFieldname = repmat('A', 1, 100)
myStruct =
myFieldname: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...'

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

Answer by Thomas Koelen on 9 Apr 2015
Edited by Thomas Koelen on 9 Apr 2015

myStruct.myFieldname = repmat('A', 1, 100);
fprintf(myStruct.myFieldname)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
:D
edit:
Just typing
myStruct.myFieldname
also showed me the whole string.

  2 Comments

This is a valid workaround. Unfortunately, it is impractical when `myStruct` has many fields. Do you have an alternative?
What exactly are you trying to do? Could you explain so I can be of better help!

Sign in to comment.