I have a cell array in Matlab named outstr
. All of elements are strings. When I try to display my array, every string comes between quotation marks like this:
>> outstr
outstr =
'a' 'b' 'Fa' 'Fb' 'Xn' 'Fx' 'sign Fa*Fx'
'0.70000' '0.90000' '-0.19592' '0.33887' '0.77327' '0.02896' '-'
'0.70000' '0.77327' '-0.19592' '0.02896' '0.76383' '0.00206' '-'
'0.70000' '0.76383' '-0.19592' '0.00206' '0.76316' '0.00012' '-'
'0.70000' '0.76316' '-0.19592' '0.00012' '0.76312' '0.00000' '-'
How do I display my array without quotations?
Something like this might meet the needs -
%// Input
outstr ={
'a' 'b' 'Fa' 'Fb' 'Xn' 'Fx' 'sign Fa*Fx'
'0.70000' '0.90000' '-0.19592' '0.33887' '0.77327' '0.02896' '-'
'0.70000' '0.77327' '-0.19592' '0.02896' '0.76383' '0.00206' '-'
'0.70000' '0.76383' '-0.19592' '0.00206' '0.76316' '0.00012' '-'
'0.70000' '0.76316' '-0.19592' '0.00012' '0.76312' '0.00000' '-' }
outstr1 = strcat(outstr,{' '}); %// add whitespace
%// Convert to char array
outstr_char = char(outstr1{:})
%// Get size parameters
[m,n] = size(outstr1)
p = size(outstr_char,2)
%// Reshape + Permute Magic to create a
%// char array "replica" of input cell array
out = reshape(permute(reshape(outstr_char.',p,m,[]),[1 3 2]),n*p,m).'
%// Display the char array
disp(out)
Sample run -
>> outstr
outstr =
'a' 'b' 'Fa' 'Fb' 'Xn' 'Fx' 'sign Fa*Fx'
'0.70000' '0.90000' '-0.19592' '0.33887' '0.77327' '0.02896' '-'
'0.70000' '0.77327' '-0.19592' '0.02896' '0.76383' '0.00206' '-'
'0.70000' '0.76383' '-0.19592' '0.00206' '0.76316' '0.00012' '-'
'0.70000' '0.76316' '-0.19592' '0.00012' '0.76312' '0.00000' '-'
>> disp(out)
a b Fa Fb Xn Fx sign Fa*Fx
0.70000 0.90000 -0.19592 0.33887 0.77327 0.02896 -
0.70000 0.77327 -0.19592 0.02896 0.76383 0.00206 -
0.70000 0.76383 -0.19592 0.00206 0.76316 0.00012 -
0.70000 0.76316 -0.19592 0.00012 0.76312 0.00000 -