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

Thread Subject: cartesian coordinates from a matrix

 Subject: cartesian coordinates from a matrix From: vespasiano Date: 22 May, 2012 18:16:06 Message: 1 of 3 Hello, I have an image which represents a black&white handmade signature. I tranformed this image into a matrix, with this command: A = imread('myImage.bmp'); A = not(img); /*I do this because I need the symbol "1" when there's a point of the signature and "0" when there isn't. */ So my matrix A has only 0 and 1 as symbols... I need to find the cartesian coordinates of the matrix's points in which there is the symbol "1" and split them into 2 vectors, X and Y. For example if my matrix is: 0 1 0 0 1 0 0 0 0 0 0 0 I need two vector like these: X = [1; 2] Y = [2; 3] because there is a symbol 1 in position (1,2) and there's a symbol 1 in position (2,3). I hope it's clear Can you help me, please?
 Subject: cartesian coordinates from a matrix From: parag2489@gmail.com Date: 22 May, 2012 18:53:18 Message: 2 of 3 From your example it seems that X =[1 2] and Y=[2 1]. you can get this by using "find" function.
 Subject: cartesian coordinates from a matrix From: vespasiano Date: 23 May, 2012 09:24:07 Message: 3 of 3 parag2489@gmail.com wrote in message <20cb842f-2294-45a6-ad95-886ca0311800@googlegroups.com>... > From your example it seems that X =[1 2] and Y=[2 1]. > you can get this by using "find" function. Yes it was exactly what I was searching for! Thank you very much! By the way, for my example: [ r, c ] = find(matrix) return this: r =      2      1 c =      1      2 but it's just a different order ;)