f



SortedMap: getting value for largest key less or equal a given value...

I've got an approach like the following, but I'm not entirely
happy with it. (see embedded comments)
Error checking left out only for brevity-of-post's sake.

<sscce>
class StepFunction<K,V> {
   SortedMap<K,V> m_map = new TreeMap<K,V>();
   public void put(K k,V v) { m_map.put(k,v); } // for demo-fill
   
   /** @return the value for the largest key in the map
          that is less OR equal to the given parameter.  */

   public V value(K k) {
      // not really correct for generic use. In my usecase, K is
      //  actually Long, so I just add one to k to make it work.
      return m_map.get(m_map.headMap(k).lastKey());

      // I'm a bit unhappy about headMap's "open end",
      // and also about the lack of some method like
      //   lastEntry() or lastKeysValue() in SortedMap,
      // requiring one to look up the lastKey in the map,
      // although the map had "its finger on it" just before.
      //   Did I miss something simple and obvious?
   }
   // demo-helper
   void checkVal(K k, V v) {
      System.out.println( map.value(k) + " should be " + v);
   }
   public static void main(String[] args) {
      StepFunction<Integer,Double> sf = new StepFunction<>()
      sf.put(Integer.MIN_VALUE, -1.0);
      sf.put(0, 0.0); sf.put(2, 1.0);

      sf.checkVal(-1 , -1.0);
      sf.checkVal( 0 ,  0.0);
      sf.checkVal( 1 ,  0.0);
      sf.checkVal( 2 ,  1.0);
      sf.checkVal(Integer.MAX_VALUE , 1.0);
   }
}
</sscce>

PS: No need to offer "solutions" involving linear search.
  I could have come up with one, myself, if I wanted one.  

0
avl1 (2748)
8/1/2012 7:45:36 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

5 Replies
484 Views

Similar Articles

[PageSpeed] 31

Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> wrote:
> I've got an approach like the following, but I'm not entirely
> happy with it...

It took me about an hour to compose that previous post, and not
only did a bug still hide in it ("map" instead of "m_map"), but
also: only five minutes after posting, it occurred to me that I
could also look at TreeMap's methods, rather than only at
SortedMap's, and thereby stumbled over the (new in 1.6) interface
NavigableMap.

PS: return m_map.floorEntry(k).getValue(); // :-)
Case closed.
0
avl1 (2748)
8/1/2012 8:19:39 PM
On 8/1/2012 1:19 PM, Andreas Leitgeb wrote:
> Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> wrote:
>> I've got an approach like the following, but I'm not entirely
>> happy with it...
>
> It took me about an hour to compose that previous post, and not
> only did a bug still hide in it ("map" instead of "m_map"), but
> also: only five minutes after posting, it occurred to me that I
> could also look at TreeMap's methods, rather than only at
> SortedMap's, and thereby stumbled over the (new in 1.6) interface
> NavigableMap.
>
> PS: return m_map.floorEntry(k).getValue(); // :-)
> Case closed.


It is my contention that any requests for help should contain a careful 
explanation of the problem and attempted solutions, plus an SSCCE.  Then 
the author should save the request on disc and go to lunch.  If no 
solution was discovered during lunch, then the request should be sent.

I think there's a Dilbert cartoon about this.



0
markspace
8/1/2012 9:48:19 PM
On Wed, 01 Aug 2012 14:48:20 -0700, markspace <-@.> wrote, quoted or
indirectly quoted someone who said :

>save the request on disc and go to lunch.

Bertrand Russell "told" me about this years ago.  You have to get away
from your computer. He suggested even a week of "not" thinking about
it for a toughie. Then when you revisit the problem, the answer will
be right under your nose.

I just think about the problem while walking.  The details are cleared
away so I have to think more abstractly. I ask myself , what could be
failing that created those symptoms.  I am not looking for particular
code, just thinking about code that does some function.  It is a
different sort of thinking than trying to decide if a line of code is
faulty.

Of course Murphy's law says the most likely time for the answer to
come to you is one second after hitting submit.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
The greatest shortcoming of the human race is our inability to understand the exponential function. 
 ~ Dr. Albert A. Bartlett (born: 1923-03-21 age: 89)
http://www.youtube.com/watch?v=F-QA2rkpBSY


0
see_website (5876)
8/2/2012 8:20:40 AM
On 8/2/12 1:20 AM, Roedy Green wrote:
> On Wed, 01 Aug 2012 14:48:20 -0700, markspace <-@.> wrote, quoted or
> indirectly quoted someone who said :
>
>> save the request on disc and go to lunch.
>
> Bertrand Russell "told" me about this years ago.  You have to get away
> from your computer. He suggested even a week of "not" thinking about
> it for a toughie. Then when you revisit the problem, the answer will
> be right under your nose.
>
> I just think about the problem while walking.  The details are cleared
> away so I have to think more abstractly. I ask myself , what could be
> failing that created those symptoms.  I am not looking for particular
> code, just thinking about code that does some function.  It is a
> different sort of thinking than trying to decide if a line of code is
> faulty.
>
> Of course Murphy's law says the most likely time for the answer to
> come to you is one second after hitting submit.
If we're talking about Murphy, then by submit you mean "deploy the hack 
workaround fix to production after a month of QA".

;-)
0
8/2/2012 4:53:02 PM
Daniel Pitts <newsgroup.nospam@virtualinfinity.net> wrote:
> On 8/2/12 1:20 AM, Roedy Green wrote:
>> On Wed, 01 Aug 2012 14:48:20 -0700, markspace <-@.> wrote, quoted or
>> indirectly quoted someone who said :
>>> save the request on disc and go to lunch.

I hardly ever go to lunch at all. Typically have a bite at the workplace...

>> Bertrand Russell "told" me about this years ago.  You have to get away
>> from your computer.

Away from the computer I couldn't have had a look at TreeMap's methods...

>> He suggested even a week of "not" thinking about it for a toughie.

Within a week of this strategy, surely one of the coworkers would have noticed
my inactivity on the task and taken it over... maybe eventually asking me what
I think I'm being paid for...   Nope, rather not let that happen ;-)

>> Of course Murphy's law says the most likely time for the answer to
>> come to you is one second after hitting submit.
Good description of what kind of happened, btw.

> If we're talking about Murphy, then by submit you mean "deploy the hack 
> workaround fix to production after a month of QA".
> ;-)
;-)
0
avl1 (2748)
8/3/2012 12:55:10 AM
Reply:

Similar Artilces:

SortedMap: getting value for largest key less or equal a given
From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> I've got an approach like the following, but I'm not entirely happy with it. (see embedded comments) Error checking left out only for brevity-of-post's sake. <sscce> class StepFunction<K,V> { SortedMap<K,V> m_map = new TreeMap<K,V>(); public void put(K k,V v) { m_map.put(k,v); } // for demo-fill /** @return the value for the largest key in the map that is less OR equal to the given parameter. */ public V value(K k) { // not really correct for generic use. In my usecase, K is // actually Long, so I just add one to k to make it work. return m_map.get(m_map.headMap(k).lastKey()); // I'm a bit unhappy about headMap's "open end", // and also about the lack of some method like // lastEntry() or lastKeysValue() in SortedMap, // requiring one to look up the lastKey in the map, // although the map had "its finger on it" just before. // Did I miss something simple and obvious? } // demo-helper void checkVal(K k, V v) { System.out.println( map.value(k) + " should be " + v); } public static void main(String[] args) { StepFunction<Integer,Double> sf = new StepFunction<>() sf.put(Integer.MIN_VALUE, -1.0); sf.put(0, 0.0); sf.put(2, 1.0); sf.checkVal(-1 , -1.0); sf.checkVal( ...

SortedMap: getting value for largest key less or equal a given #4
From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-5qr-this> From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-yy0-this> From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-s5y-this> From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> I've got an approach like the following, but I'm not entirely happy with it. (see embedded comments) Error checking left out only for brevity-of-post's sake. <sscce> class StepFunction<K,V> { SortedMap<K,V> m_map = new TreeMap<K,V>(); public void put(K k,V v) { m_map.put(k,v); } // for demo-fill /** @return the value for the largest key in the map that is less OR equal to the given parameter. */ public V value(K k) { // not really correct for generic use. In my usecase, K is // actually Long, so I just add one to k to make it work. return m_map.get(m_map.headMap(k).lastKey()); // I'm a bit unhappy about headMap's "open end", // and also about the lack of some method like // lastEntry() or lastKeysValue() in SortedMap, // requiring one to look up the lastKey in the map, // although the map had "its finger on it" just before. // Did I miss something simple and obvious? } // demo-helper void checkVal(K k, V v) { System.out.println( map.value(k) + " should be " + v);...

SortedMap: getting value for largest key less or equal a given #2
From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-s5y-this> From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> I've got an approach like the following, but I'm not entirely happy with it. (see embedded comments) Error checking left out only for brevity-of-post's sake. <sscce> class StepFunction<K,V> { SortedMap<K,V> m_map = new TreeMap<K,V>(); public void put(K k,V v) { m_map.put(k,v); } // for demo-fill /** @return the value for the largest key in the map that is less OR equal to the given parameter. */ public V value(K k) { // not really correct for generic use. In my usecase, K is // actually Long, so I just add one to k to make it work. return m_map.get(m_map.headMap(k).lastKey()); // I'm a bit unhappy about headMap's "open end", // and also about the lack of some method like // lastEntry() or lastKeysValue() in SortedMap, // requiring one to look up the lastKey in the map, // although the map had "its finger on it" just before. // Did I miss something simple and obvious? } // demo-helper void checkVal(K k, V v) { System.out.println( map.value(k) + " should be " + v); } public static void main(String[] args) { StepFunction<Integer,Double> sf = new StepFunction<>() sf.put(Integer.MIN_VALUE, -1.0); ...

SortedMap: getting value for largest key less or equal a given #3
From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-yy0-this> From: "Andreas Leitgeb" <andreas.leitgeb@1:261/38.remove-s5y-this> From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> I've got an approach like the following, but I'm not entirely happy with it. (see embedded comments) Error checking left out only for brevity-of-post's sake. <sscce> class StepFunction<K,V> { SortedMap<K,V> m_map = new TreeMap<K,V>(); public void put(K k,V v) { m_map.put(k,v); } // for demo-fill /** @return the value for the largest key in the map that is less OR equal to the given parameter. */ public V value(K k) { // not really correct for generic use. In my usecase, K is // actually Long, so I just add one to k to make it work. return m_map.get(m_map.headMap(k).lastKey()); // I'm a bit unhappy about headMap's "open end", // and also about the lack of some method like // lastEntry() or lastKeysValue() in SortedMap, // requiring one to look up the lastKey in the map, // although the map had "its finger on it" just before. // Did I miss something simple and obvious? } // demo-helper void checkVal(K k, V v) { System.out.println( map.value(k) + " should be " + v); } public static void main(String[] args) { StepFunction<Integer,Dou...

How to get the iterator for a value less than the key specified?
Neither of the two methods, lower_bound and upper_bound, for std::set does return the iterator less than the key specified. Is there a better way to approach this? template <typename Set> typename Set::const_reverse_iterator less_lower_bound(Set const & set, typename Set::const_reference key) { Set::key_compare key_comp = set.key_comp(); Set::const_reverse_iterator i = set.rbegin(); for (; i != set.rend(); ++i) { if (!key_comp(key, *i)) { break; } } return i; } [ See http://www.gotw.ca/resources/clcm.htm for info about ] ...

Getting values in between the values of a vector?
Say I have a vector that's like this: [-6 -3 0 3 6] How can I get it get the number in between each of the two values to return something like: [-4.5 -1.5 1.5 4.5] Is there a built-in function that can do this? I'm asking because I'd like to avoid a loop if possible (but I'm thinking it's the only way). Thanks! "Brandon Rodriguez" <coasters2k@yahoo.com> wrote in message <gsfp69$19b$1@fred.mathworks.com>... > Say I have a vector that's like this: > > [-6 -3 0 3 6] > > How can I get it get the number in between each of the two v...

hash key to var name of value hash key value
i'd like to now if their is a simpler way to do that : IN_NEWS=@h['IN_NEWS'] because here i do have to know their is a key of name "IN_NEWS" want i want is to affet the value of all the @h['key_name'] to the variable key_name ??? (as far as i remember well it's possible in php then i think this is also possible in ruby )))) -- une b�vue Une b�vue wrote: > i'd like to now if their is a simpler way to do that : > > IN_NEWS=@h['IN_NEWS'] > > because here i do have to know their is a key of name "IN_NEWS" > > wa...

Value if _page_ value into another value??
I am trying to get my Mtitle and Footer with in the dataset Instead of getting them as title and Footnotes the reason My boss requested (there is Other reason ) For that I am doing something like this My Problem is trying to get Titles in the Dataset, When I trying something like this The second title is Over writing the First one. But I need my Report some thing like this . Is there is something similar to *compute before _page_ or can I have value of _page_ into some other value.* MYPHARMA Page 1 of 3 . PEN 20007 Table 14.1.4 Demographic Characteristics Modified Intent-To-Treat Subjects /* CREATE REPORT */ ods rtf file = "&dir1.T14_1_2_MXXX_1303.RTF" style=autoexec; title "" ; Footnote"" ; proc report data= &Program. nowd missing split='?' style(header)=[protectspecialchars=off]; columns ("&border" (page _userFoot _PageNo _lastLine Sec Row Col0 Col2_1 Col2_1 Col2_2 Col2_3 Col2_4 )); define _userFoot / order Noprint ; define _PageNo / order Noprint ; define _lastLine / order Noprint ; define page/ order order=internal noprint; define Sec/ order noprint; define Row/ order noprint; define Col0 / display "Variable" style=[cellwidth=2.1in] style(header)=[just=left]; define Col2_1 /display "Placebo?(N=%cmpres(&all_plac.))&quo...

sort multi-key hash by value and print out with key value pairs
I am trying to sort hash elements with the following structure: %hashname{$npanxx}{$node}{$plan} = cost so that i get plans ordered by lowest to greatest cost, in the format of: $npanxx:: $node :: $plan :: cost i have the solution for SET 1(see below), where the second key ($node) completes the hash member and gives me back what i want. I just can't solve for the higher order hash. any help would be appreciated. sample data for SET 1 and SET 2 and code for SET 1 follows: %RS = (); ###SET 1 $RS{206231}{SEA} = 1.2; $RS{206231}{NYC} = 11.2; $RS{206231}{LAX} = 4.2; $RS{206231}{CHI} = 10.2...

Select values from a given value backward
Hello, starting from a given point I have to select values backward. My digitized signal looks like the one available here [1]. I should create a new vector containing values from the first lowest value of the signal (about at 1.6s in the figure on the link below) backward for about 1 second in time (of course the sampling frequency is known). The reference starting value (lowest value) change for each given test trial. Basically, if I have 3 trials they will all look similar but they will not be synchronised. Indeed, the final aim is to synchronise multiple signals from a common poi...

get keys with the same values
Hello, I have a dictionary and will get all keys which have the same values. d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)} I will something as : d.keys(where their values are the same) With this statement I can get two lists for this example: l1= ['a','e'] l2=['b','d'] Would somebody tell me how I can do it? Regards, Nader Nader: > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)} > I will something as : > d.key...

Re: Value if _page_ value into another value??
On Mon, 3 Dec 2007 23:25:03 -0500, SAS_learner <proccontents@GMAIL.COM> wrote: >I am trying to get my Mtitle and Footer with in the dataset Instead of >getting them as title and Footnotes the reason My boss requested (there is >Other reason ) For that I am doing something like this > >My Problem is trying to get Titles in the Dataset, When I trying something >like this The second title is Over writing the First one. But I need my >Report some thing like this . Is there is something similar to *compute >before _page_ or can I have value of _page_ into some other value.* > >MYPHARMA >Page 1 of 3 . >PEN 20007 > > > Table 14.1.4 > Demographic >Characteristics > Modified Intent-To-Treat >Subjects > >/* CREATE REPORT */ >ods rtf file = "&dir1.T14_1_2_MXXX_1303.RTF" style=autoexec; >title "" ; >Footnote"" ; >proc report data= &Program. nowd missing split='?' >style(header)=[protectspecialchars=off]; > columns ("&border" (page _userFoot _PageNo _lastLine Sec Row Col0 Col2_1 >Col2_1 Col2_2 Col2_3 Col2_4 )); > define _userFoot / order Noprint ; > define _PageNo / order Noprint ; > define _lastLine / order Noprint ; > define page/ order order=internal noprint; > d...

Find Y values from a given X values
I've a set of experimental data which has a like Gaussian profile. I want to find the values of X or (index) for Y0 (Y maximum), Y0/10, Y0/20... Y)/90 like that from the raw data. Y0 and its index can be found from the 'max' function, but corresponding to Y0/10, Y0/20 and all there are no discrete X values. The X values have to come from interpolated data. The "interp1" option doesn't work since it gives Y for a given x. I need the reverse. Thanks in advance "josevm" wrote in message <k9hurn$iki$1@newscl01ah.mathworks.com>... > I've a set of experimental data which has a like Gaussian profile. I want to find the values of X or (index) for Y0 (Y maximum), Y0/10, Y0/20... Y)/90 like that from the raw data. Y0 and its index can be found from the 'max' function, but corresponding to Y0/10, Y0/20 and all there are no discrete X values. The X values have to come from interpolated data. The "interp1" option doesn't work since it gives Y for a given x. I need the reverse. Thanks in advance Interchange the roles of X and Y in the call to interp1: xi = interp1(Y,X,yi); Best wishes Torsten. "Torsten" wrote in message <k9i3a8$2nv$1@newscl01ah.mathworks.com>... > "josevm" wrote in message <k9hurn$iki$1@newscl01ah.mathworks.com>... > > I've a set of experimental data which has a like Gaussian profile. I want to find the values of X or (index) for Y0 (Y maxi...

setting getElementById().value equal to variable value
I'm working with the script below which works with FF but not with IE 7. To clarify, the part of the code which isn't working in IE 7 is putting the value of variable y in the "totalString" input box and alert. Thanks for any help, Louis ------------------------------------------------- <script type="text/javascript"> function upperCase() { var x=document.getElementById("fname").value; document.getElementById("fname").value=x.toUpperCase(); //var b="used cars"; //alert(x); } function numFlag() { var y=document.getElementById(&quo...

How to get inimum value from 16 values available
Dear all, I've a specific problem. Hope some one will answer me. I have a color image, say img1, of 512 X 512 size in CIELAB space. For each pixel in img1, I've 16 sample pixels approximated as follows (E1 is another image obtained by some process) Lp1(x,y) = img1(x,y,1); ap1(x,y) = img1(x,y,2) + E1(x,y); bp1(x,y) = img1(x,y,3); Lp2(x,y) = img1(x,y,1); ap2(x,y) = img1(x,y,2) + E1(x,y)/sqrt(2); bp2(x,y) = img1(x,y,3) + E1(x,y)/sqrt(2); Lp3(x,y) = img1(x,y,1); ap3(x,y) = img1(x,y,2); ...

comparing values in table to a value keyed into textbox
at moment im trying to compare a value that i type in a text box to values in the field of a table and if there is a match then there field is updated like in the code below. but when i try it access is not responding.can any one help. may be its looping endlessly? i dono. help anyone Private Sub password_AfterUpdate() Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("SELECT KeywordIN FROM name") rs.MoveFirst Do Until rs.EOF If rs.Fields("KeywordIN").Value = Me.password.Value Then Me.Presence = "s...

href values and value-of
Hello. I am creating an xml list of links with structure like the below: <item> <title>Bullet Madness</title> <uri>http://www.stylegala.com/archive/bulletmadness/</uri> <description>200 bullets, each of them nice in their own way</description> </item> I need to create a link with that data. When I tried to do something like <a href="<xsl:value-of select="uri">">text</a> I got the error that the structure was not well formed. How else would I create a link with proper structure? Thanks, Dante Dante (29 Sep 2004 20:46:59 -0700): > <item> > <title>Bullet Madness</title> > <uri>http://www.stylegala.com/archive/bulletmadness/</uri> > <description>200 bullets, each of them nice in their own > way</description> > </item> > > I need to create a link with that data. When I tried to do something > like > <a href="<xsl:value-of select="uri">">text</a> <a> <xsl:attribute><xsl:value-of select="uri"/></xsl:attribute> text </a> Chris -- Chris Huebsch www.h�bsch-gemacht.de | TU Chemmnitz, Informatik, RNVS GPG-Encrypted mail welcome! ID:7F2B4DBA | Str. d. Nationen 62, B204 Chemnitzer Linux-Tage 2005, 5.-6.M�rz | D-09107 Chemnitz http://chemnitzer.linux-tage.de/ | +49 371 531-1377, Fax -1803 Dante (pianoman@reno.com) wr...

Re: Value if _page_ value into another value?? #4
On Tue, 4 Dec 2007 08:30:48 -0600, Yu Zhang <zhangyu05@GMAIL.COM> wrote: >Check out the ODS RTF TEXT=, which allow you to write stuff in the main body >of the document. But text is still put into a cell like thing. you will see >a border around the text, but it wil be invisible when you print it out. Not >sure if it will solve your problem. > >HTH > >Yu > >On Dec 4, 2007 8:23 AM, SAS_learner <proccontents@gmail.com> wrote: > >> Tom, >> >> Thank you for the Reply, I know what you are saying defining Footnotes and >> Titles Outside would send it RTF Part. >> >> But my Medical Writers are having a Problem while doing their changes to >> delete the header and footer part when it is written Out by RTF , >> >> That is Reason I need Footnotes and titles inside the Dataset so that it >> would be easy for them >> >> thanks >> Kumar >> >> On Dec 4, 2007 5:11 AM, Tom Hide <tom.hide@dehiworld.com> wrote: >> >> > On Mon, 3 Dec 2007 23:25:03 -0500, SAS_learner <proccontents@GMAIL.COM> >> > wrote: >> > >> > >I am trying to get my Mtitle and Footer with in the dataset Instead of >> > >getting them as title and Footnotes the reason My boss requested (there >> > is >> > >Other reason ) For that I am doing something like this >> > > >> > >My Proble...

how to catch a value from radio buttom getting its value from mysql?
Hi, this is a newbie question. How can I catch the selected radio value from a form that is feed by the mysql database? EX.: <input type="radio" name="myname" value="<?php $myvalue[3] ?>"> Value returns the last element of the array $myvalue[3] instead of the selected value. How can I change this? Thanks in advance for any help, Guillermina echo? <input type="radio" name="myname" value="<?php echo $myvalue[3] ?>"> PWT "gmanon" <guillermina@nyc.rr.com> wrote in messa...

VALUES and CALL-WITH-VALUES
I want to know why VALUES and CALL-WITH-VALUES are necessary in Scheme. They seem to have no meaning independently. Aren't the following simple macros are sufficient? From a practical point of view such as variable bindings, the latter macros are rather better than the former procedures. (define-syntax mu (syntax-rules () ((mu argument ...) (lambda (m) (m argument ...))))) (define-syntax nu (syntax-rules () ((nu argument arguments ...) (lambda (n) (apply n argument arguments ...))))) ((mu 1 2 3) +) => 6 (call-with-values (lambda () (values 1 2 3)) +) => 6...

Re: Value if _page_ value into another value?? #3
Check out the ODS RTF TEXT=, which allow you to write stuff in the main body of the document. But text is still put into a cell like thing. you will see a border around the text, but it wil be invisible when you print it out. Not sure if it will solve your problem. HTH Yu On Dec 4, 2007 8:23 AM, SAS_learner <proccontents@gmail.com> wrote: > Tom, > > Thank you for the Reply, I know what you are saying defining Footnotes and > Titles Outside would send it RTF Part. > > But my Medical Writers are having a Problem while doing their changes to > delete the header and footer part when it is written Out by RTF , > > That is Reason I need Footnotes and titles inside the Dataset so that it > would be easy for them > > thanks > Kumar > > On Dec 4, 2007 5:11 AM, Tom Hide <tom.hide@dehiworld.com> wrote: > > > On Mon, 3 Dec 2007 23:25:03 -0500, SAS_learner <proccontents@GMAIL.COM> > > wrote: > > > > >I am trying to get my Mtitle and Footer with in the dataset Instead of > > >getting them as title and Footnotes the reason My boss requested (there > > is > > >Other reason ) For that I am doing something like this > > > > > >My Problem is trying to get Titles in the Dataset, When I trying > > something > > >like this The second title is Over writing the First one. But I need > my > > >Report some thing like this . Is there is ...

To find y-value if x-value is given in a plot
After making a plot, how do I create MATLAB code to provide me with a value of y if x is given as a fix number. Assume y has a complicated expression that can't be simply inversed (in order to get x). For example: x=1:70; y=1-[1:70]/70; % Plotting position formula semilogy(sort(x),y) % If x is 50, y=? %This is my interest Thank you. "Zahiraniza Mustaffa" <zahiraniza.nospam@mathworks.com> wrote in message <fe2gh1$jh$1@fred.mathworks.com>... > After making a plot, how do I create MATLAB code to > provide me with a value of y if x is given as a fix > number. Assume y has a complicated expression that can't > be simply inversed (in order to get x). > > For example: > > x=1:70; > y=1-[1:70]/70; % Plotting position formula > semilogy(sort(x),y) > % If x is 50, y=? %This is my interest > > Thank you. In your example, it's y(50) more generally you could make a function function Y = f(X, Xi, Yi) idx = find(X == Xi); Y = Yi(idx); Where Xi and Yi are your original vectors and X is the input value of x Don't use sort(x) inside of semilogy(). If you're going to sort the x values you should do it before you calculate y. In your example code it does nothing. ~Adam On Oct 4, 8:43 am, "Adam " <not.my.em...@mathworks.com> wrote: > "Zahiraniza Mustaffa" <zahiraniza.nos...@mathworks.com> > wrote in message <fe2gh1$j...@fred.mathworks.com&...

Values depending on other values
Hi all, I have to insert some rows in a database and some values in this rows depends on the values of other rows in the database. This new value must continue up to date dependig on the value of the origin data. �How could I do this? I�ve been thinking of using triggers that update the variable values but, is there any other way? Thanks in advance NegreT wrote: > Hi all, > > I have to insert some rows in a database and some values in this rows > depends on the values of other rows in the database. > > This new value must continue up to date dependig on the value of the > origin data. > > �How could I do this? I�ve been thinking of using triggers that update > the variable values but, is there any other way? > > Thanks in advance You should almost never store the result of a calculation in a relational database. Why not calculate the value on the fly for display on screen or in reports? -- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan@x.washington.edu (replace 'x' with a 'u' to reply) Hi Daniel, thanks for your reply. The situation is : - I've got a table with records (each record is a state of a sensor). - I've got a form that reads those records and can add more. What I have to do: - Users must be able to insert records with the current value of the sensor (easy). - Users must be abl...

how to get approximate differential value from pure mesh values
I have function numerical values on a uniform mesh points. But I do not know the explicit form of this function. Now the approximate value of first or second order derivative is wanted. Does there exist a Matlab funtion to do this? Otherwise any suggestions are welcome. suniuin wrote: > I have function numerical values on a uniform mesh points. But I do > not know the explicit form of this function. Now the approximate > value of first or second order derivative is wanted. > > Does there exist a Matlab funtion to do this? Otherwise any > suggestions are welcome. finite di...

Web resources about - SortedMap: getting value for largest key less or equal a given value... - comp.lang.java.programmer

Resources last updated: 3/19/2016 8:17:22 PM