help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Location Programming


From: Nicholas Ablett
Subject: Re: Location Programming
Date: Wed, 15 Feb 2017 18:42:50 +0000

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 <address@hidden>
Date: 2017/02/15 17:28 (GMT+02:00)
To: Nicholas Ablett <address@hidden>
Cc: address@hidden
Subject: Re: Location Programming

On Wed, Feb 15, 2017 at 5:39 AM, Nicholas Ablett
<address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]