octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #57523] [Feature Request] legend should accept


From: Guillaume
Subject: [Octave-bug-tracker] [bug #57523] [Feature Request] legend should accept 2-letter abbreviations for "Location" property
Date: Tue, 4 May 2021 17:47:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #3, bug #57523 (project octave):

No sure what is the cleanest way to implement this. What about:


location = get (hl, "location");

locations = {"North", "East", "South", "West", "NorthEast", "SouthEast",
"SouthWest", "NorthWest"}; # ...
acronyms = cellfun (@(x) tolower (x(x>='A' & x<='Z')),  locations,
"UniformOutput", false);
locations = tolower (locations);
acr2loc = cell2struct (locations, acronyms, 2);
try
  location = acr2loc.(location);
end_try_catch
location = location(~isspace (location));
idx = strmatch (location, locations);
if (isscalar (idx))
  location = locations{idx};
endif


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57523>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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