Prev: ButtonDownFcn
Next: Windows 7
From: A on 22 Apr 2010 09:57 On Apr 22, 3:25 pm, "Steven Lord" <sl...(a)mathworks.com> wrote: > "A" <aragorn1...(a)gmail.com> wrote in message > > news:0a43ac2c-1442-45a7-a363-f4079d0399ab(a)r27g2000yqn.googlegroups.com... > > > Hi, > > > Given a value "val = 50", say, I would like to create a vector, vec, > > of length "5", with the first element as 1 and last element as 50. > > However, the intermediate elements are generated this way. > > > I have two values say, U = 9 and V = 25. Then, I should have the > > values 9,25 also included in this vector as "consecutive values" and > > the other value should be automatically generated. For example, vec = > > [1, 9, 25, 37, 50]. Here, between 25 and 50, I had to generate 1 value > > and its chosen as the mid-value. > > You said "between 25 and 50, I had to generate 1 value". What required you > to generate a new point between 25 and 50 as opposed to between 1 and 9? > > > Suppose U = 1 and V = 14, then, we already have the value 1 in the > > vector vec. So, we will have to generate 2 values here. So vec = [1, > > 14, 26, 39, 50]. Here 14:50 is split into 3 values of equal length. > > > Of course if U = 1 and V = 50, then its not possible, we just generate > > an error message (as the vector length is 5 and U,V must be > > consecutive). > > How can I do this? Any ideas? > > Your problem is underspecified. > > -- > Steve Lord > sl...(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ:http://matlabwiki.mathworks.com/MATLAB_FAQ Hi Steve, >You said "between 25 and 50, I had to generate 1 value". What required you to generate a new point between 25 and 50 as opposed to between 1 and 9? Yes, it is also possible. I am sorry I dint explain it clear enough. Let me put it this way. Given a maximum value, say 50, and two other values, U and V (which might be equal to 1 or 50 too), I have to create a vector, VEC, of length 5, with values 1, 50, and the 2 other values specified, U and V (in case its = 1 or 50, we ignore the second 1 or 50) and fill in the other value ourselves (preferably as a mid value between the two values where it is inserted). Is this possible?
|
Pages: 1 Prev: ButtonDownFcn Next: Windows 7 |