Good Day, I am stuck with creating a program that maps distance travelled and am severely out of practice on octave, this is not like riding a bike. To summarise what is required, I need a program that will calculate how far a warehouse picker walks
with each order between each item. My idea is that the octave program pulls a bin location from the WMS, this is in alpha-numeric form (AE-036-13 for example). This location is then referenced to a position in a matrix (Eg AE-036-13 is in matrix location A(1,3)).
The matrix is configured to have rows and columns equivalent to the number of rows and columns in the warehouse. The program then pulls the next location and works out the difference between the locations using the indexes. From there I can include the distance factor. Really rough example: m= 10; n= 8; A = zeros(m,n); %Zero Matrix Created B = abs([1,1]- [3,3]) %Manual Matrix Locations Entered xdis = B(1,1) ydis = B(1,2) Travel = xdis + ydis What I can’t do currently or understand is: Why the formula for B does not need any reference to matrix A?
How to save an alpha-numeric code into a matrix location (There will be multiple codes per matrix location as well) How to get the program to “spit out” the matrix location after entering the alpha-numeric code. How to get the matrix location values to automatically transfer into the equation for B. Regards Nicholas Ablett
_______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
On Wed, Feb 15, 2017 at 5:39 AM, Nicholas Ablett
<[hidden email]> wrote: > > What I can’t do currently or understand is: > > Why the formula for B does not need any reference to matrix A? > > How to save an alpha-numeric code into a matrix location (There will be multiple codes per matrix location as well) > > How to get the program to “spit out” the matrix location after entering the alpha-numeric code. > > How to get the matrix location values to automatically transfer into the equation for B. > > It's good you're breaking down the problem into manageable pieces. And thanks for telling us the overall intent. (It avoids wasting time solving problems that maybe weren't needing in the first place. See xyproblem.info for an educational explanation.) You've stored no useful information in A. it's just an array of zeros. it has the size from m and n, but m and n already contain that information, so it's not clear what you want to use A for. your current B doesn't reference A because you've just put arbitrary values in the formula. But, assuming you put your location codes in something called 'A'. then you find which locations in A to use for calculation, then your (location1 - location2) formula would need to reference that information. You'll need a variable to hold that location info, and then your '[1,1]-[3,3]' line would be replaced by something like 'location1-location2' Now, some other answers to your questions: - alpha numeric code into a matrix: assuming you need to store your code as a string and later do a string comparison, it's probably easiest to create a cell array. matrices can store strings, but only one character per location. a = 'hello' is actually a(1,1) = 'h', a(1,2) = 'e', etc. All strings need to be the same length, and you'd have to do some 3-dimensional trickery to store your strings in a matrix. Better is to use a cell. A cell array can hold arbitrary things in each location. Cells are (generally) referenced with curly braces. eg., >> b{1,1} = 4; >> b{1,2} = 'hello'; >> b{2,1} = 'world'; >> b{2,1} = false; >> b b = { [1,1] = 4 [2,1] = world [1,2] = hello [2,2] = 0 } So, you should be able to create an array with each cell location containing your bin name strings. Learn more about using and accessing cells here: https://www.gnu.org/software/octave/doc/v4.2.0/Basic-Usage-of-Cell-Arrays.html https://www.gnu.org/software/octave/doc/v4.2.0/Creating-Cell-Arrays.html Not really sure what you mean by 'multiple codes per matrix location' - spitting out a location after entering a code: first what do you mean by 'entering a code'? are you prompting the user to type in two codes/locations? do you know how to do that? Assuming you do, and you store the users input as a string, you will then need to do a string comparison with those in the cell array you created above. (note the command below will fail if every cell location isn't a string) >> b{1,1} = 'world'; >> b{1,2} = 'hello'; >> b{2,1} = 'hello'; >> b{2,2} = 'world'; >> strcmp(b,'hello') ans = 0 1 1 0 OR >> find(strcmp(b,'hello')) ans = 2 3 you can then use the location(s) in whatever way you find useful. _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
In reply to this post by Nicholas Ablett
Hi Nicholas,
Thanks for your comprehensive reply, I will add additional comments in brackets next to yours to further explain.
Kind Regards
Nic
Sent from my Samsung Galaxy smartphone.
-------- Original message --------
From: Nicholas Jankowski <[hidden email]>
Date: 2017/02/15 17:28 (GMT+02:00)
To: Nicholas Ablett <[hidden email]>
Cc: [hidden email]
Subject: Re: Location Programming
On Wed, Feb 15, 2017 at 5:39 AM, Nicholas Ablett
<[hidden email]> wrote: > > What I can’t do currently or understand is: > > Why the formula for B does not need any reference to matrix A? > > How to save an alpha-numeric code into a matrix location (There will be multiple codes per matrix location as well) > > How to get the program to “spit out” the matrix location after entering the alpha-numeric code. > > How to get the matrix location values to automatically transfer into the equation for B. > > It's good you're breaking down the problem into manageable pieces. And thanks for telling us the overall intent. (It avoids wasting time solving problems that maybe weren't needing in the first place. See xyproblem.info for an educational explanation.) You've stored no useful information in A. it's just an array of zeros. it has the size from m and n, but m and n already contain that information, so it's not clear what you want to use A for. (Matrix A is just a place holder for the actual matrix that will hold the bin locations) your current B doesn't reference A because you've just put arbitrary values
in the formula. (The values were meant to represent two positions within the A matrix, the problem is how to get those locations from A to automatically populate B) But, assuming you put your location codes in something called 'A'. then you find which locations in A to use for calculation, then your (location1 - location2) formula would need to reference that information. You'll need a variable to hold that location info, and then your '[1,1]-[3,3]' line would be replaced by something like 'location1-location2' (this is the key part I am struggling with, would I say something like location1 = A[1,1] ? I don't need the data in that position of the matrix I need the actual position ie: the 1 and 1. I want the input of the location codes to give
me a matrix location.)
Now, some other answers to your questions: - alpha numeric code into a matrix: assuming you need to store your code as a string and later do a string comparison, it's probably easiest to create a cell array. matrices can store strings, but only one character per location. a = 'hello' is actually a(1,1) = 'h', a(1,2) = 'e', etc. All strings need to be the same length, and you'd have to do some 3-dimensional trickery to store your strings in a matrix. Better is to use a cell. A cell array can hold arbitrary things in each location. Cells are (generally) referenced with curly braces. eg., >> b{1,1} = 4; >> b{1,2} = 'hello'; >> b{2,1} = 'world'; >> b{2,1} = false; >> b b = { [1,1] = 4 [2,1] = world [1,2] = hello [2,2] = 0 } So, you should be able to create an array with each cell location containing your bin name strings. Learn more about using and accessing cells here: https://www.gnu.org/software/octave/doc/v4.2.0/Basic-Usage-of-Cell-Arrays.html https://www.gnu.org/software/octave/doc/v4.2.0/Creating-Cell-Arrays.html (I will definitely give this a look, thank you) Not really sure what you mean by 'multiple codes per matrix location' (In the warehouse there are multiple bins that will correspond to a location on the matrix, so I will have to enter multiple bin locations for each matrix location. Eg A(1,1) = ae-02-32 ; ae-02-33 ; ae-02-34. I don't even know if this is possible. And to give you an idea there are 57 000 bins.) - spitting out a location after entering a code: first what do you mean by 'entering a code'? are you prompting the user to type in two codes/locations? do you know how to do that? (Ideally the program should draw the bin locations from our warehouse management system, it creates a picking slip that sends a picker to each bin location, a location is shown as ae-02-33 for example. I have some experience with the fetch data functions but am not sure what format the WMS will provide data.) Assuming you do, and you store the users input as a string, you will then need to do a string comparison with those in the cell array you created above. (note the command below will fail if every cell location isn't a string)(I will be sure the data pulled in will be stored a string and all the data will be in the same format as ae-02-33.) >> b{1,1} = 'world'; >> b{1,2} = 'hello'; >> b{2,1} = 'hello'; >> b{2,2} = 'world'; >> strcmp(b,'hello') ans = 0 1 1 0 OR >> find(strcmp(b,'hello')) ans = 2 3 you can then use the location(s) in whatever way you find useful. (I want to use the difference in the locations in the matrix as a unit measure eg: I know the distance between lateral bins is 3m and longitudinal bins is 5m. So if ae-02-33 is at A(1,1) and af-02-35 is at A(2,3) the movement is abs(1-2) longitudinal and abs(1-3) lateral so 1 and 2. Therefore distance walked is 1×5 + 2×3 = 11.) I don't know if I am making this more complicated than necessary.
_______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
Free forum by Nabble | Edit this page |