From: LV on
I have a triangular matrix,

A= [ 1 1 1
2 2
3 ]

That I would like to display as a full matrix,

B = [ 1 1 1
2 2 2
3 3 3 ]


Is there a MATLAB command to perform this operation? I have been unsuccessful finding an easy way to do this conversion.
From: Oleg Komarov on
"LV " <i.like.miso.soup(a)gmail.com> wrote in message <hjv3b6$8fh$1(a)fred.mathworks.com>...
> I have a triangular matrix,
>
> A= [ 1 1 1
> 2 2
> 3 ]
>
> That I would like to display as a full matrix,
>
> B = [ 1 1 1
> 2 2 2
> 3 3 3 ]
>
>
> Is there a MATLAB command to perform this operation? I have been unsuccessful finding an easy way to do this conversion.

Can you post the result of
disp(A)
and
whos A

Oleg
From: LV on
>> disp(A)
1 1 1
2 2 0
3 0 0

>> whos data1
Name Size Bytes Class Attributes

A 3x3 72 double
From: Jos (10584) on
"LV " <i.like.miso.soup(a)gmail.com> wrote in message <hjv5jl$56e$1(a)fred.mathworks.com>...
> >> disp(A)
> 1 1 1
> 2 2 0
> 3 0 0
>
> >> whos data1
> Name Size Bytes Class Attributes
>
> A 3x3 72 double

So, A is already a full matrix, but you want to fill the zero positions with the same value on each of the rows. Now, does A always look like this? There are several solutions, depending on how A is defined:

B = repmat(A(:,1),1,3)
B = fillzero(A,2) % on the FEX:
% http://www.mathworks.nl/matlabcentral/fileexchange/19906

hth
Jos
From: Matt Fig on
Or also:

A = A(:,[1 1 1]) % or repmat(A(:,1),1,size(A,2))