From: ravi on
Hi guys,

I have a matrix X
X =

658 1072
96 103
760 1089
292 298


I wish INSTEAD to output like this:

X = 658 1072 96 103
760 1089 292 298


Can anyone suggest something


ravi
From: Jan Simon on
Dear Ravi!

> I have a matrix X
> X =
> 658 1072
> 96 103
> 760 1089
> 292 298
>
> I wish INSTEAD to output like this:
> X = 658 1072 96 103
> 760 1089 292 298

Do you mean something like this:
fprintf('%s = %g %g %g %g\n', 'X', transpose(X(1, :));
fprintf(' %g %g %g %g\n', transpose(X(2:end, :));

Jan
From: ravi on
i would like to do this in some kind off loop assuming X would get larger by 2 rows incrementally


Ravi




"ravi " <ravi_071(a)hotmail.com> wrote in message <hu8qhb$pq1$1(a)fred.mathworks.com>...
> Hi guys,
>
> I have a matrix X
> X =
>
> 658 1072
> 96 103
> 760 1089
> 292 298
>
>
> I wish INSTEAD to output like this:
>
> X = 658 1072 96 103
> 760 1089 292 298
>
>
> Can anyone suggest something
>
>
> ravi
From: ravi on
Thanks Jan,but When I use your solution it has some parentheses error

Ravi










"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hu8u98$bst$1(a)fred.mathworks.com>...
> Dear Ravi!
>
> > I have a matrix X
> > X =
> > 658 1072
> > 96 103
> > 760 1089
> > 292 298
> >
> > I wish INSTEAD to output like this:
> > X = 658 1072 96 103
> > 760 1089 292 298
>
> Do you mean something like this:
> fprintf('%s = %g %g %g %g\n', 'X', transpose(X(1, :));
> fprintf(' %g %g %g %g\n', transpose(X(2:end, :));
>
> Jan
From: Jan Simon on
Dear Ravi!

> > fprintf('%s = %g %g %g %g\n', 'X', transpose(X(1, :));
> > fprintf(' %g %g %g %g\n', transpose(X(2:end, :));
> > Jan

> Thanks Jan,but When I use your solution it has some parentheses error
> Ravi

Yes, I obviously forgot the closing parentheses. I think you can fix this.

Jan
 |  Next  |  Last
Pages: 1 2
Prev: MATLAB Mex Error
Next: progress bar and time display