From: eesa on
Hi,
I have got this kind of problem in matlab and i could not solve it from the last three weeks.

I have this table like this
table =

1 1 6
1 2 3
1 3 1
6 1 2
6 2 1
6 11 1
8 1 5
8 2 2

and i want to present each row in the different cloums like:

1 1 6 1 2 3 1 3 1
6 1 2 6 2 1 6 11 1
8 1 5 8 2 2
I would appreciate if any expertise can colve this problem.
Many thanks,
From: Walter Roberson on
eesa wrote:
> Hi, I have got this kind of problem in matlab and i could not solve it
> from the last three weeks.
>
> I have this table like this
> table =
>
> 1 1 6
> 1 2 3
> 1 3 1
> 6 1 2
> 6 2 1
> 6 11 1
> 8 1 5
> 8 2 2
>
> and i want to present each row in the different cloums like:
>
> 1 1 6 1 2 3 1 3 1
> 6 1 2 6 2 1 6 11 1
> 8 1 5 8 2 2
> I would appreciate if any expertise can colve this problem.

Could you expand more on what you mean by "present" ? Is this for text to a
screen? Something to be written to a text file?

It is not possible to construct a numeric matrix with a different number of
columns in each row. It is, though, possible to construct character matrices
that happen to have blanks past a certain point on the line.


If your table happens to be exactly a multiple of 9 elements (so the number of
columns per line would be the same), then

table_by_9 = reshape(table .', 9, []) .' ;
From: eesa on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i3acso$3dl$1(a)canopus.cc.umanitoba.ca>...
> eesa wrote:
> > Hi, I have got this kind of problem in matlab and i could not solve it
> > from the last three weeks.
> >
> > I have this table like this
> > table =
> >
> > 1 1 6
> > 1 2 3
> > 1 3 1
> > 6 1 2
> > 6 2 1
> > 6 11 1
> > 8 1 5
> > 8 2 2
> >
> > and i want to present each row in the different cloums like:
> >
> > 1 1 6 1 2 3 1 3 1
> > 6 1 2 6 2 1 6 11 1
> > 8 1 5 8 2 2
> > I would appreciate if any expertise can colve this problem.
>
> Could you expand more on what you mean by "present" ? Is this for text to a
> screen? Something to be written to a text file?
>
> It is not possible to construct a numeric matrix with a different number of
> columns in each row. It is, though, possible to construct character matrices
> that happen to have blanks past a certain point on the line.
>
>
> If your table happens to be exactly a multiple of 9 elements (so the number of
> columns per line would be the same), then
>
> table_by_9 = reshape(table .', 9, []) .' ;

what i need is to create another table from the original table and showing the new format of the data so, is there any way to do that.
From: eesa on
"eesa " <alalyani(a)hotmail.com> wrote in message <i3afjb$o8n$1(a)fred.mathworks.com>...
> Walter Roberson <roberson(a)hushmail.com> wrote in message <i3acso$3dl$1(a)canopus.cc.umanitoba.ca>...
> > eesa wrote:
> > > Hi, I have got this kind of problem in matlab and i could not solve it
> > > from the last three weeks.
> > >
> > > I have this table like this
> > > table =
> > >
> > > 1 1 6
> > > 1 2 3
> > > 1 3 1
> > > 6 1 2
> > > 6 2 1
> > > 6 11 1
> > > 8 1 5
> > > 8 2 2
> > >
> > > and i want to present each row in the different cloums like:
> > >
> > > 1 1 6 1 2 3 1 3 1
> > > 6 1 2 6 2 1 6 11 1
> > > 8 1 5 8 2 2
> > > I would appreciate if any expertise can colve this problem.
> >
> > Could you expand more on what you mean by "present" ? Is this for text to a
> > screen? Something to be written to a text file?
> >
> > It is not possible to construct a numeric matrix with a different number of
> > columns in each row. It is, though, possible to construct character matrices
> > that happen to have blanks past a certain point on the line.
> >
> >
> > If your table happens to be exactly a multiple of 9 elements (so the number of
> > columns per line would be the same), then
> >
> > table_by_9 = reshape(table .', 9, []) .' ;
>
> what i need is to create another table from the original table and showing the new format of the data so, is there any way to do that.

Hi All,
I would appreciate if there is any one have an idea how i can solve this kind of problem
Many thanks,
From: Steven_Lord on


"eesa " <alalyani(a)hotmail.com> wrote in message
news:i3b3is$bbm$1(a)fred.mathworks.com...
> "eesa " <alalyani(a)hotmail.com> wrote in message
> <i3afjb$o8n$1(a)fred.mathworks.com>...

*snip*

>> what i need is to create another table from the original table and
>> showing the new format of the data so, is there any way to do that.
>
> Hi All,
> I would appreciate if there is any one have an idea how i can solve this
> kind of problem

No, because it's not clear specifically how you're getting from the old
format to the new format, and whether you want the data to be stored in a
variable or written to disk in the new format. State SPECIFICALLY what
problem you're trying to solve and you may receive some help.

If you're looking to create a variable in memory where different rows have
different numbers of columns, this is not possible in MATLAB. Variables in
MATLAB MUST be rectangular (or the N-D equivalent thereof.)

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com