Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How Coordinates form Array List with comma

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 25 Feb, 2014 06:22:08

Message: 1 of 9

Hi,

      I am new for mat-lab , I have input video file , need to form like ?
Example:
if true
  % code
for int i=1:2
matrix{1,i}=[co-ordinate_x; co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
end

matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357, 258, 303, 258, 350]]]
% here how i could i form above 1-by-8 matrix each input video frame values like...
end

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 28 Feb, 2014 08:05:08

Message: 2 of 9

"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lehcqg$82p$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am new for mat-lab , I have input video file , need to form like ?
> Example:
> if true
> % code
> for int i=1:2
> matrix{1,i}=[co-ordinate_x; co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
> end
>
> matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357, 258, 303, 258, 350]]]
> % here how i could i form above 1-by-8 matrix each input video frame values like...
> end
How to form matrix like matrix =[318, 323, 197, 357, 258, 303, 258, 350]
[318, 323, 197, 357, 258, 303, 258, 350] % Because for loop up to 2 ending

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 3 Mar, 2014 03:25:07

Message: 3 of 9

"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lepfvk$qf2$1@newscl01ah.mathworks.com>...
> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lehcqg$82p$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I am new for mat-lab , I have input video file , need to form like ?
> > Example:
> > if true
> > % code
> > for int i=1:2
> > matrix{1,i}=[co-ordinate_x; co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
> > end
> >
> > matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357, 258, 303, 258, 350]]]
> > % here how i could i form above 1-by-8 matrix each input video frame values like...
> > end
> How to form matrix like matrix =[318, 323, 197, 357, 258, 303, 258, 350]
> [318, 323, 197, 357, 258, 303, 258, 350] % Because for loop up to 2 ending

Now i have tried to do below like that please help to me how i can form like matrix =[1,2,3,4,5,6,7,8]

example : matrix =[1,2,3,4,5,6,7,8];
              spring_fun=['%d,',matrix(1,:)];
             spring_fun = ['[%s'],spring_fun];
Now i got result like that matrix=[1,2,3,4,5,6,7,8,]; ,but i want to remove last column value after comma .can you please let me know ?

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 3 Mar, 2014 08:32:10

Message: 4 of 9

"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lf0smj$t0c$1@newscl01ah.mathworks.com>...
> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lepfvk$qf2$1@newscl01ah.mathworks.com>...
> > "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lehcqg$82p$1@newscl01ah.mathworks.com>...
> > > Hi,
> > >
> > > I am new for mat-lab , I have input video file , need to form like ?
> > > Example:
> > > if true
> > > % code
> > > for int i=1:2
> > > matrix{1,i}=[co-ordinate_x; co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
> > > end
> > >
> > > matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357, 258, 303, 258, 350]]]
> > > % here how i could i form above 1-by-8 matrix each input video frame values like...
> > > end
> > How to form matrix like matrix =[318, 323, 197, 357, 258, 303, 258, 350]
> > [318, 323, 197, 357, 258, 303, 258, 350] % Because for loop up to 2 ending
>
> Now i have tried to do below like that please help to me how i can form like matrix =[1,2,3,4,5,6,7,8]
>
> example : matrix =[1,2,3,4,5,6,7,8];
> spring_fun=['%d,',matrix(1,:)];
> spring_fun = ['[%s'],spring_fun];
> Now i got result like that matrix=[1,2,3,4,5,6,7,8,]; ,but i want to remove last column value after comma .can you please let me know ?

Thank you so much reply to me ...Now I got below result like .

Example :

disp(outputString);
  outputString =[1, 2, 3, 4, 5, 6, 7, 8, ][1, 2, 3, 4, 5, 6, 7, 8, ];
*Note-1 : May i know how i can remove comma after 8 .

Note-2 : I would like to get like outputString =[1, 2, 3, 4, 5, 6, 7, 8][1, 2, 3, 4, 5, 6, 7, 8];*

Subject: How Coordinates form Array List with comma

From: Steven Lord

Date: 3 Mar, 2014 16:23:49

Message: 5 of 9


"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
news:lf0smj$t0c$1@newscl01ah.mathworks.com...
> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> <lepfvk$qf2$1@newscl01ah.mathworks.com>...
>> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
>> <lehcqg$82p$1@newscl01ah.mathworks.com>...
>> > Hi,
>> >
>> > I am new for mat-lab , I have input video file , need to form
>> > like ?
>> > Example:
>> > if true
>> > % code
>> > for int i=1:2
>> > matrix{1,i}=[co-ordinate_x;
>> > co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
>> > end
>> >
>> > matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357,
>> > 258, 303, 258, 350]]]
>> > % here how i could i form above 1-by-8 matrix each input video frame
>> > values like...
>> > end
>> How to form matrix like matrix =[318, 323, 197, 357, 258, 303, 258, 350]
>> [318, 323, 197, 357, 258, 303, 258, 350] % Because for loop up to 2
>> ending
>
> Now i have tried to do below like that please help to me how i can form
> like matrix =[1,2,3,4,5,6,7,8]
>
> example : matrix =[1,2,3,4,5,6,7,8];
> spring_fun=['%d,',matrix(1,:)];
> spring_fun = ['[%s'],spring_fun];
> Now i got result like that matrix=[1,2,3,4,5,6,7,8,]; ,but i want to
> remove last column value after comma .can you please let me know ?

If you're asking how to convert a numeric array into a string representation
(to display, hopefully, NOT to EVAL later on to recreate the matrix!) see
MAT2STR.

http://www.mathworks.com/help/matlab/ref/mat2str.html

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 6 Mar, 2014 06:40:14

Message: 6 of 9

"Steven Lord" <Steven_Lord@mathworks.com> wrote in message <lf2aag$jiq$1@newscl01ah.mathworks.com>...
>
> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> news:lf0smj$t0c$1@newscl01ah.mathworks.com...
> > "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> > <lepfvk$qf2$1@newscl01ah.mathworks.com>...
> >> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> >> <lehcqg$82p$1@newscl01ah.mathworks.com>...
> >> > Hi,
> >> >
> >> > I am new for mat-lab , I have input video file , need to form
> >> > like ?
> >> > Example:
> >> > if true
> >> > % code
> >> > for int i=1:2
> >> > matrix{1,i}=[co-ordinate_x;
> >> > co-ordinate_y;co-ordinate_xx;co-ordinate_y_y;co-ordinate_z_x;co-ordinate_z_y;co-ordinate_p_x;co-ordinate_p_y];
> >> > end
> >> >
> >> > matrix=[[318, 323, 197, 357, 258, 303, 258, 350], [318, 323, 197, 357,
> >> > 258, 303, 258, 350]]]
> >> > % here how i could i form above 1-by-8 matrix each input video frame
> >> > values like...
> >> > end
> >> How to form matrix like matrix =[318, 323, 197, 357, 258, 303, 258, 350]
> >> [318, 323, 197, 357, 258, 303, 258, 350] % Because for loop up to 2
> >> ending
> >
> > Now i have tried to do below like that please help to me how i can form
> > like matrix =[1,2,3,4,5,6,7,8]
> >
> > example : matrix =[1,2,3,4,5,6,7,8];
> > spring_fun=['%d,',matrix(1,:)];
> > spring_fun = ['[%s'],spring_fun];
> > Now i got result like that matrix=[1,2,3,4,5,6,7,8,]; ,but i want to
> > remove last column value after comma .can you please let me know ?
>
> If you're asking how to convert a numeric array into a string representation
> (to display, hopefully, NOT to EVAL later on to recreate the matrix!) see
> MAT2STR.
>
> http://www.mathworks.com/help/matlab/ref/mat2str.html
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Than's for reply me , now i want to pass vector /matrices values to Java method argument List<Integer> points ?
On Matlab-side :
matrix =[22,11,3,2,1,1,2,1];%1-by-8 matrix
 outputString = sprintf('%d,', handles.matrix);
    outputString = sprintf('[%s\b]', outputString);
    disp(outputString);
    import edu.lipreading.*;
    training = MainMethod;
    training.list_method(outputString);
%Here [22,11,3,2,1,1,2,1] these values need to pass Java Method but i got error like signature class method mismatch?
On Java Side:
public static void list_method(List<Integer> points){
recordedSample.getMatrix().add(points); //Sample Class object
}

Subject: How Coordinates form Array List with comma

From: Steven Lord

Date: 6 Mar, 2014 14:50:12

Message: 7 of 9


"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
news:lf958e$1mn$1@newscl01ah.mathworks.com...
> "Steven Lord" <Steven_Lord@mathworks.com> wrote in message
> <lf2aag$jiq$1@newscl01ah.mathworks.com>...

*snip*

> Than's for reply me , now i want to pass vector /matrices values to Java
> method argument List<Integer> points ?
> On Matlab-side :
> matrix =[22,11,3,2,1,1,2,1];%1-by-8 matrix
> outputString = sprintf('%d,', handles.matrix);
> outputString = sprintf('[%s\b]', outputString);
> disp(outputString); import edu.lipreading.*;
> training = MainMethod;
> training.list_method(outputString);
> %Here [22,11,3,2,1,1,2,1] these values need to pass Java Method but i got
> error like signature class method mismatch?
> On Java Side:
> public static void list_method(List<Integer> points){
> recordedSample.getMatrix().add(points); //Sample Class object }

The Java method is defined to accept a List object. You're attempting to
pass it a MATLAB char array. I _believe_ Java methods that accept a
java.lang.String can accept a MATLAB char array in its place (and that
conversion takes place automatically), but you're trying to make applesauce
with a basket of oranges.

Construct a Java List object using your matrix and pass that List object
into the method. You may need to convert the double array named matrix into
an integer array using one of the integer functions.

http://www.mathworks.com/help/matlab/matlab_prog/integers.html

If you're not sure how to construct the Java List object, see the third,
fifth, and sixth Concepts on this documentation page:

http://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html

Also refer to the documentation for the Java List class on Oracle's website.

If you encounter difficulties, please reply to THIS THREAD rather than
creating a sixth thread for this same question or contact Technical Support.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 7 Mar, 2014 05:34:09

Message: 8 of 9

"Steven Lord" <Steven_Lord@mathworks.com> wrote in message <lfa1uv$aur$1@newscl01ah.mathworks.com>...
>
> "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> news:lf958e$1mn$1@newscl01ah.mathworks.com...
> > "Steven Lord" <Steven_Lord@mathworks.com> wrote in message
> > <lf2aag$jiq$1@newscl01ah.mathworks.com>...
>
> *snip*
>
> > Than's for reply me , now i want to pass vector /matrices values to Java
> > method argument List<Integer> points ?
> > On Matlab-side :
> > matrix =[22,11,3,2,1,1,2,1];%1-by-8 matrix
> > outputString = sprintf('%d,', handles.matrix);
> > outputString = sprintf('[%s\b]', outputString);
> > disp(outputString); import edu.lipreading.*;
> > training = MainMethod;
> > training.list_method(outputString);
> > %Here [22,11,3,2,1,1,2,1] these values need to pass Java Method but i got
> > error like signature class method mismatch?
> > On Java Side:
> > public static void list_method(List<Integer> points){
> > recordedSample.getMatrix().add(points); //Sample Class object }
>
> The Java method is defined to accept a List object. You're attempting to
> pass it a MATLAB char array. I _believe_ Java methods that accept a
> java.lang.String can accept a MATLAB char array in its place (and that
> conversion takes place automatically), but you're trying to make applesauce
> with a basket of oranges.
>
> Construct a Java List object using your matrix and pass that List object
> into the method. You may need to convert the double array named matrix into
> an integer array using one of the integer functions.
>
> http://www.mathworks.com/help/matlab/matlab_prog/integers.html
>
> If you're not sure how to construct the Java List object, see the third,
> fifth, and sixth Concepts on this documentation page:
>
> http://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html
>
> Also refer to the documentation for the Java List class on Oracle's website.
>
> If you encounter difficulties, please reply to THIS THREAD rather than
> creating a sixth thread for this same question or contact Technical Support.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Thank's for reply me ,below i have details implement ,but i got error like :No method 'list_method' with matching signature found for class 'edu.lipreading.MainMethod'.Please let me know where i have done mistaken made?
On mat-lab Side
matrix =[3,22,1,2,2,2,23,3]; %1-by-8 matrix
list=java.util.ArrayList();
 for k=1:length(matrix)
       list.add(int32(matrix(k)));
   end
 import edu.lipreading.*;
 training = MainMethod;
 training.list_method(list.add(int32(matrix(k))));
On Java Side
public void list_method(Double[] points){
List lList = Arrays.asList(points); //How i can convert Double [] to List Integer List<Integer> points?
recordedSample.getMatrix().add(lList); //Java Class Object
}
I have Expected result like : [355, 292, 277, 291, 316, 272, 316, 305] add my List Integer may i know how i can solve ?
}

Subject: How Coordinates form Array List with comma

From: SAMEER ahamed

Date: 7 Mar, 2014 05:39:09

Message: 9 of 9

"SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <lfbloh$pmq$1@newscl01ah.mathworks.com>...
> "Steven Lord" <Steven_Lord@mathworks.com> wrote in message <lfa1uv$aur$1@newscl01ah.mathworks.com>...
> >
> > "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message
> > news:lf958e$1mn$1@newscl01ah.mathworks.com...
> > > "Steven Lord" <Steven_Lord@mathworks.com> wrote in message
> > > <lf2aag$jiq$1@newscl01ah.mathworks.com>...
> >
> > *snip*
> >
> > > Than's for reply me , now i want to pass vector /matrices values to Java
> > > method argument List<Integer> points ?
> > > On Matlab-side :
> > > matrix =[22,11,3,2,1,1,2,1];%1-by-8 matrix
> > > outputString = sprintf('%d,', handles.matrix);
> > > outputString = sprintf('[%s\b]', outputString);
> > > disp(outputString); import edu.lipreading.*;
> > > training = MainMethod;
> > > training.list_method(outputString);
> > > %Here [22,11,3,2,1,1,2,1] these values need to pass Java Method but i got
> > > error like signature class method mismatch?
> > > On Java Side:
> > > public static void list_method(List<Integer> points){
> > > recordedSample.getMatrix().add(points); //Sample Class object }
> >
> > The Java method is defined to accept a List object. You're attempting to
> > pass it a MATLAB char array. I _believe_ Java methods that accept a
> > java.lang.String can accept a MATLAB char array in its place (and that
> > conversion takes place automatically), but you're trying to make applesauce
> > with a basket of oranges.
> >
> > Construct a Java List object using your matrix and pass that List object
> > into the method. You may need to convert the double array named matrix into
> > an integer array using one of the integer functions.
> >
> > http://www.mathworks.com/help/matlab/matlab_prog/integers.html
> >
> > If you're not sure how to construct the Java List object, see the third,
> > fifth, and sixth Concepts on this documentation page:
> >
> > http://www.mathworks.com/help/matlab/using-java-libraries-in-matlab.html
> >
> > Also refer to the documentation for the Java List class on Oracle's website.
> >
> > If you encounter difficulties, please reply to THIS THREAD rather than
> > creating a sixth thread for this same question or contact Technical Support.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
> Thank's for reply me ,below i have details implement ,but i got error like :No method 'list_method' with matching signature found for class 'edu.lipreading.MainMethod'.Please let me know where i have done mistaken made?
> On mat-lab Side
> matrix =[355, 292, 277, 291, 316, 272, 316, 305]; %1-by-8 matrix
> list=java.util.ArrayList();
> for k=1:length(matrix)
> list.add(int32(matrix(k)));
> end
> import edu.lipreading.*;
> training = MainMethod;
> training.list_method(list.add(int32(matrix(k))));
> On Java Side
> public void list_method(Double[] points){
> List lList = Arrays.asList(points); //How i can convert Double [] to List Integer List<Integer> points?
> recordedSample.getMatrix().add(lList); //Java Class Object
> }
> I have Expected result like : [355, 292, 277, 291, 316, 272, 316, 305] add my List Integer may i know how i can solve ?
> }

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us