f



get rid of for loops/vectorization

Hello all,
I would like get rid of loop in code below. I am not sure is it possible because x changes each time and it is multiplying each time .

InputU=4*rand(2,15);
W=sparse(2*ones(4,4));% sparse matrix
Win=3*ones(4,2);%  matrix
sizeinputU=size(InputU,2);
temp=zeros(15,4);
x=zeros(4,1);% vector 
for t=1:sizeinputU
x=Win*InputU(:,t)+W*x;
temp(t,:)=x';
end

Thanks in advance.
BRSU
0
4/28/2012 6:29:34 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
370 Views

Similar Articles

[PageSpeed] 5

"Elizaveta " <elizashpieva@gmail.com> wrote in message <jng2oe$9d1$1@newscl01ah.mathworks.com>...
> Hello all,
> I would like get rid of loop in code below. I am not sure is it possible because x changes each time and it is multiplying each time .
> 
> InputU=4*rand(2,15);
> W=sparse(2*ones(4,4));% sparse matrix
> Win=3*ones(4,2);%  matrix
> sizeinputU=size(InputU,2);
> temp=zeros(15,4);
> x=zeros(4,1);% vector 
> for t=1:sizeinputU
> x=Win*InputU(:,t)+W*x;
> temp(t,:)=x';
> end
> 

% You might diagonalize the system,
% Full vectorizatio n can be done with polynomial but not worth it

InputU = rand(2,15);
W = sparse(rand(4,4));% sparse matrix
W = W+W'
Win=rand(4,2);% matrix
sizeinputU=size(InputU,2);

temp=zeros(sizeinputU,4);
x=zeros(4,1);% vector

%% old Engine
for t=1:sizeinputU
    x=Win*InputU(:,t)+W*x;
    temp(t,:)=x';
end
temp

%% New engine
[V D] = eig(full(W));
A = Win*InputU;
A = V\A;
B = zeros(4,sizeinputU);
x = zeros(4,1);
d = diag(D);
for t=1:sizeinputU
    x = A(:,t)+d.*x;
    B(:,t) = x;
end
B = (V*B)'

% Bruno
0
b.luong5955 (6401)
4/28/2012 8:12:25 AM
If only last value of x is of interest, then this would do:

InputU = rand(2,15);
W = sparse(rand(4,4));% sparse matrix
W = W+W';
Win=rand(4,2);% matrix
sizeinputU=size(InputU,2);

temp=zeros(sizeinputU,4);
x=zeros(4,1);% vector

%% old Engine
for t=1:sizeinputU
    x=Win*InputU(:,t)+W*x;
    temp(t,:)=x';
end
x

%% "Vectorized" engine
[V D] = eig(full(W));
A = Win*InputU;
A = V \ A;
d = diag(D);
x = V*arrayfun(@(k) polyval(A(k,:),d(k)), (1:4)')

% Bruno
0
b.luong5955 (6401)
4/28/2012 2:19:19 PM
Reply:

Similar Artilces:

getting a value from a while loop to input back into the loop
This program is supposed to recognize an input voltage of 5V and then proceed to start&nbsp;the vertical bar picture box moving either left or right, per the users choice. The user can also input the desired bar width, scroll speed, and cycle duration (time to get from left to right and back). I want the picture box to move left and right repeately and smoothly. On frame #3, I created what I believe to be a state machine. The outer while loop should obtain the resulting position value from the inner while loop and then use that value as the new starting position. For some reason, the picture box will start moving left (if "Left" is chosen as the initial direction) and then remain on the left while shaking. It should rather move from the left back to the right and back left again. How do I fix this problem? Thank you!! &nbsp; (the first attachment is with the state machine. the second has the same problem as the first but has a less complicated format) &nbsp; vert rect with state machine.vi: http://forums.ni.com/attachments/ni/170/193862/1/vert rect with state machine.vi vert rect without state machine.vi: http://forums.ni.com/attachments/ni/170/193862/2/vert rect without state machine.vi I am unable to view your changes because I only have LabView 7.0. Could you post print screen images of your changes? Thank you so much! ...

how to get iteration value of the for loop outside the loop
Hi, &nbsp; I would like to get the Iteration value of the FOR loop outside the FOR loop. This is because I want to tab the iteration value for the purpose of moving from one array value to another as I want to enable user to change the Delay value. &nbsp;Therefore I've come out with the idea of taking the [&nbsp;frequency / (user input) Delay ] to change the delay time. Is there any way for me to tab the iteration value?? &nbsp; Thanks.. stage3.vi: http://forums.ni.com/attachments/ni/170/309249/1/stage3.vi Book1.csv: http://forums.ni.com/attachments/ni/170/309249/2/Book1.csv ...

Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow: result=zeros(25,16000); for i = 1:length(vector1) % length is 25 for j = 1:length(vector2) % length is 16000 temp1 = vector1(i); temp2 = vector2(j); t1 = load(matfiles1(temp1).name) %load image1 from matfile1 t2 = load(matfiles2(temp2).name) % load image2 from matfile2 result(i,j)=t1.*t2 end end It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance! ...

issues with vector of vector of vectors
Gurus, Is this possible to do? Do any of you see any issues? typedef pair<string, string> myPair; typedef vector<myPair> myPairVector; typedef vector<myPairVector> myPairVectorColl; typedef vector<myPairVectorColl> myPairVectorCollCollection; Now when I initialize a variable of myPairVectorCollCollection, the size of this vector is unusually large( both in the debug as well as release versions ) And when I look at the stack trace during debugging, I am going nuts...this is how it shows up( even though the vector has only two elemts): _Mylast = [3291966109]([...](),[...](),[...](),[...](),[...](),[...](), [...](),[...](),[...](),[...](),[...](),[...](),[...](),[...](),[...] (),[...](),[...](),[...](),[...](),[...](),[...](),[...](),[...](), [...](),[...](),[...](),[...](),[...](),[...](),[...](),[...... _Myend = [3291966109]([...](),[...](),[...](),[...](),[...](),[...](), [...](),[...](),[...](),[...](),[...](),[...](),[...](),[...](),[...] (),[...](),[...](),[...](),[...](),[...](),[...](),[...](),[...](), [...](),[...](),[...](),[...](),[...](),[...](),[...](),[...... Is this a valid datastructure? If not what am I doing wrong? Thanks in advance curious wrote: > Is this a valid datastructure? If not what am I doing wrong? It is a valid datastructure. Many implementations of std::vector are pre allocating elements. The size of your datastructure is large, because there is a cubical usage of pre allocation. On Jun 3, 7:18=A0pm, Andreas Fis...

Vectorize loop
I have a 1000x27 matrix called HourlyData. I would like to get the mean of each column corresonding to each particular day and return in a vector e.g. Day Value1 Value2 ... 1 3 6 1 4 7 1 5 8 2 6 9 2 6 9 2 6 9 MeanVals = [1 4 7; 2 6 9] I can do this with a loop. Iwould like to vectorize this loop without using accumarray, if possible? for i=1:NumDays DailyMean(i,1:27)=nanmean(HourlyData(floor(HourlyData(:,1))==(StartDate+i),:)); end "Brian" wrote in message <jthdsc$iem$1@newscl01ah.mathworks.com>... >. Iwould like to vectorize this loop without using accumarray, if possible? A silly answer for a silly request: A=[ 1 3 6; 1 4 7; 1 5 8; 2 6 9; 2 6 9] [~,~,I]=unique(A(:,1)); [I J]=ndgrid(I,1:size(A,2)); full(sparse(I,J,A)./sparse(I,J,1)) % Bruno Warning: this method is not very accurate numerically for large data: [A1, p] = sort(A(:,1)); i = find([true; diff(A1); true]); B = cumsum([zeros(1,size(A,2)); A(p,:)],1); i2 = i(2:end); i1 = i(1:end-1); bsxfun(@rdivide,B(i2,:)-B(i1,:),i2-i1) % Bruno ...

how to get rid of this
I have installed SyGate about 4-5 weeks ago. I have Comcast service at the time of Sygate installation and I still have the same Internet service. I used to have DSL. I have treid to remove and deleted anyhting that has to do with DSL before SyGAte installation. Someone helped me remove bad entries from running hiJjackThis during Sygate installation. About 3 weeks ago, a comcast tech came by and replaced a new modem and configuartion. A few days ago I experience a window popped up with title "Enetr Network Password" with the folling info: Server: smtp:sbcglobal.yahoo.com User name: ****@sbcglobal.net Password: I can't closed this window not cancel. What do I need to do? I believe all my posrts inclduing smtp is blocked properly. Thanks. heyimjustcurious@yahoo.com (curious) wrote in news:ca3e516b.0402221022.622d9b61@posting.google.com: > I have installed SyGate about 4-5 weeks ago. > > I have Comcast service at the time of Sygate installation and I still > have the same Internet service. > > I used to have DSL. > > I have treid to remove and deleted anyhting that has to do with DSL > before SyGAte installation. Someone helped me remove bad entries from > running hiJjackThis during Sygate installation. > > About 3 weeks ago, a comcast tech came by and replaced a new modem and > configuartion. > > A few days ago I experience a window popped up with title "Enetr > Network Password" with ...

LOOP and +LOOP
With LOOP, since the index (I) increases by 1 with each loop iteration, we can test for equality as a means to determine if it's time to exit the loop or not: : TEST 10 0 DO I . LOOP ; TEST 0 1 2 3 4 5 6 7 8 9 Here, when I gets to 10, the loop exits. It's not so easy with +LOOP, since the index can be changed by any arbitrary value on each iteration: : TEST 100 0 DO I . RANDOM +LOOP ; Here, we cannot test for equality. We have to test for crossing a boundary instead, at least as far as I can see. With that in mind, are these following results correct: : TEST 10 0 DO I . 1 +LOOP ; TEST 0 1 2 3 4 5 6 7 8 9 10 (11 iterations) : TEST 10 0 DO I . 3 +LOOP ; TEST 0 3 6 9 (4 iterations) : TEST -30 -7 DO I . -3 +LOOP ; TEST -7 -10 -13 -16 -19 -22 -25 -28 (8 iterations) Regards Mark On Nov 25, 10:34=A0pm, MarkWills <markrobertwi...@yahoo.co.uk> wrote: > With LOOP, since the index (I) increases by 1 with each loop > iteration, we can test for equality as a means to determine if it's > time to exit the loop or not: > > : TEST 10 0 DO I . LOOP ; > TEST > 0 1 2 3 4 5 6 7 8 9 > > Here, when I gets to 10, the loop exits. > > It's not so easy with +LOOP, since the index can be changed by any > arbitrary value on each iteration: > > : TEST 100 0 DO I . RANDOM +LOOP ; > > Here, we cannot test for equality. We have to test for crossing a > boundary instead, at least as far as I can see. > > With that in mi...

loops in loops
In the attached vi, the one second loop runs at one second and can't be touched.&nbsp; In the ten second loop, the ten second clock is a stand in for a process that generates a finished signal. The problem is once the process is complete, to start it again, leave the one second loop running, and start an additional process that will take less time than 10 seconds. thanks internal loops.vi: http://forums.ni.com/attachments/ni/170/319512/1/internal loops.vi Hi exo, what do you try there? If you start your vi, the value from your stop button will be read and after that, both loops "one" second and "ten" second won�t notice the state change of the stop button. Can you please explain, what you try to do?? Mike Okay, let me try again. I need three loops. Two loops start at the same time one runs fast one runs slow. The slow one is probably independent to the problem. When the second loop is done, it needs to restart and start a third loop that takes less than the second. You have a very basic dataflow problems. Unfortunately, I don't understand your description. &nbsp; I would recommend starting with some basic LabVIEW tutorials. &nbsp; Here are some&nbsp;obvious mistakes: - Your loop cannot read changes in the stop button, because the terminal is outside the loop. - You reset "internal loop" to zero in parallel to the loops. You cannot guarantee that this will happen before the locals are read so you might have a race c...

while loop in a while loop
Hi all, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am trying to write a program with a while loop within another while loop. When I run the vi both while loops&nbsp; run but then only the inner while loop seems to update, I adjust controls and they have no effect on the indicators. &nbsp; Thanks.. The outer while loop will not update until the inner while loop finishes, at which point the whole dance will start again You need to familiarize with the concept of dataflow programming. Run your VI in "execution highligthing" mode while watching the diagram and you'll get a better feeling on how things work. :) &nbsp; If both loops need to run in parallel, place them next to each other without data dependency. &nbsp; Can you explain what you are trying to do? :) So is it a bad idea to have one within the other if I was them to run simultaniously? Should I put the two whileloops side by side? I have attached the block diagram Thanks &nbsp; Block Diagram.JPG: http://forums.ni.com/attachments/ni/170/319250/1/Block Diagram.JPG sparrowroad wrote:So is it a bad idea to have one within the other if I was them to run simultaniously? Should I put the two whileloops side by side? I have attached the block diagram It all depends what your program should do There are scenarios where stacked loops are appropriate. Typically, one loop is sufficient if you want to run most of the code at 500ms interval, but some p...

I noticed that any other code in my while loop only gets called at the 1st time through the loop and when a event is executed.
HI there! &nbsp; I have a while loop, in which i am reading from/writing&nbsp; to a compact rio. Furthermore, i added a event structure, its the 1st time i'm using it so i'm a bit lost at times. &nbsp; I have the event structure set up for all my button i want to trigger an event. However, i have some other code which i would also like to be executed, evebn though no event has been executed. &nbsp; I noticed that the other stuff in the loop only gets executed the 1st time through the loop and when an event is triggered. &nbsp; My question therefore is, how do i get the other stuff to execute as well? &nbsp; Please advise. &nbsp; Thanks. Regards, Hi there! &nbsp; Thanks for your advice, i think that should help me continue with my stuff... &nbsp; Thanks. Regards, ...

Nested FOR loops. (a loop within a loop)
I can't get my head around them. I have two MySQL tables, one contains the categories, the other contains the posts. Each post is linked to a category. Now I'm trying to display each post with a drop down menu that has the categories in it and have the category that the post is in selected. Here's my code for the drop down menu where my woes lie. for ($i=0; $i<count($posts); $i++) { for ($j=1; $j<=count($categories); $j++) { if ($j == $post[$i]['id']) { selected = ' selected="selected"'; } else { selected = ''; } $category_list .= '<option value="' . $j . '"' . $selected . '>' . $cat_name[$j] . '</option>'; } unset($j); $dropdown .= '<td><select name="' . $cat_name[$i]['name'] . '">'. $category_list . '</select></td>'; } Here's my problem, for ease, lets say I have 2 categories and 100 posts. For post one I have 2 categories in the menu. For the next post I have 4 categories in the menu (the 2 have been doubled), for the third I have 6 (tripled), and so on. Each post after the next has another 2 categories added. So the drop down menu for post 100 has 200 categories listed. Just the same two repeated over and over. The output should look like this, though an <option> for each category, but just two for this example....

what diference between timed loop and while loop and for loop
If I want to count 2 second working in the loop and next then going out of the loop I don't know&nbsp;which the loop &nbsp;I can use Message Edited by Jairak on 07-26-2008 03:14 PM Why do you need a loop to count for 2 seconds? To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's <a href="http://zone.ni.com/devzone/cda/tut/p/id/5054" target="_blank">Learning Center</a> which provides links to other materials and other tutorials. You can also take the <a href="http://www.ni.com/academic/lv_training/how_learn_lv.htm" target="_blank">online courses</a> for free. Hi, &nbsp; From the information you have provided, I don't know exactly what you are trying to do. However, if you want a loop to iterate once, wait until two seconds and then exit the loop, use the "Wait Until Next ms Multiple" function, wire in a numeric constant "2000" and wire a boolean true constant to the loop condition of the while loop to iterate once, or use a for loop with "1" wired into the loop count. &nbsp; Perhaps you need to elaborate your question. Plus, check out the context help (press Ctrl + H) for a consice report on each of the loops. &nbsp; Regards, Jairak wrote: If I want to count 2 second working in the loop and next then going out of the loop I don't know&nbsp;which the loop ...

Getting rid of duplicates
I have a table, TEST_TABLE, with 6 columns (COL1, COL2, COL3, COL4, COL5, COL6).... I need to be able to select all columns/rows where COL3, COL4, and COL5 are unique.... I have tried using DISTINCT and GROUP BY, but both will only allow me to access columns COL3, COL4, and COL5..... i need access to all columns...I just want to get rid of duplicate rows (duplicates of COL3, COL4, and COL5)... Thanks in advance. Joe If a row is duplicated on (col3, col4, col5) which values do you want for col1 and col2? Here's some example data: CREATE TABLE Sometable (col1 INTEGER NOT NULL, col2 INTEGER NOT NULL, col3 INTEGER NOT NULL, col4 INTEGER NOT NULL, col5 INTEGER NOT NULL /* PRIMARY KEY ??? */) INSERT INTO Sometable VALUES (1,2,3,4,5) INSERT INTO Sometable VALUES (2,1,3,4,5) If you don't care which values go into col1 and col2: SELECT MIN(col1) AS col1, MIN(col2) AS col2, col3, col4, col5 FROM Sometable GROUP BY col3, col4, col5 If you want just one row from the table for each value of (col3, col4, col5): SELECT MIN(S1.col1) AS col1, S1.col2, S1.col3, S1.col4, S1.col5 FROM Sometable AS S1 JOIN (SELECT MIN(col2) AS col2, col3, col4, col5 FROM Sometable GROUP BY col3, col4, col5) AS S2 ON S1.col2 = S2.col2 AND S1.col3 = S2.col3 AND S1.col4 = S2.col4 AND S1.col5 = S2.col5 GROUP BY S1.col2, S1.col3, S1.col4, S1.col5 Try out one of these two queries. If you need more help, please post DDL and sample data (CREATE and INSERT statements as above...

How to get rid of spyware?
Can anyone suggest a good free program to remove spyware from a PC using Windows 98? I found Ad-Aware at: http://www.docsdownloads.com/spyware.htm Would that be about as good as anything else? On Sat, 31 Jul 2004 17:29:18 GMT, dh_ld@nomail.com while sniffing the trees left this message >Can anyone suggest a good free program to remove spyware from >a PC using Windows 98? > >I found Ad-Aware at: http://www.docsdownloads.com/spyware.htm >Would that be about as good as anything else? Sorry I don't do cross posts. Wolfman Even a man who is pure at heart And says his prayers by night May become a wolf when the wolfsbane blooms And the autumn moon is bright When you are running with the pack, you had better watch where you step! On Sat, 31 Jul 2004 17:29:18 GMT, dh_ld@nomail.com wrote: >Can anyone suggest a good free program to remove spyware from >a PC using Windows 98? > >I found Ad-Aware at: http://www.docsdownloads.com/spyware.htm >Would that be about as good as anything else? That and Spybot wolfman wrote: > > On Sat, 31 Jul 2004 17:29:18 GMT, dh_ld@nomail.com while sniffing the > trees left this message > > >Can anyone suggest a good free program to remove spyware from > >a PC using Windows 98? > > > >I found Ad-Aware at: http://www.docsdownloads.com/spyware.htm > >Would that be about as good as anything else? > > Sorry I don't do cross posts. You j...

Getting rid of powerlines
Any tips on getting rid of power lines in a photo? I have tried the cloning tool, healing brush etc but still some obvious markings left in photo - have experimented with different settings to no avail? Many thanks Cheers Ron "Ron" <ronjs@tpg.com.au> wrote in message news:449eec3b$1@dnews.tpgi.com.au... > Any tips on getting rid of power lines in a photo? I have tried the > cloning tool, healing brush etc but still some obvious markings left in > photo - have experimented with different settings to no avail? > > Many thanks > > Cheers > > Ron Having done this a few times and never had any problems with the cloning tool, might be worth puting in a link to the picture to see what the problem is. > > "Ron" <ronjs@tpg.com.au> wrote in message news:449eec3b$1@dnews.tpgi.com.au... > Any tips on getting rid of power lines in a photo? I have tried the > cloning tool, healing brush etc but still some obvious markings left in > photo - have experimented with different settings to no avail? > > Many thanks > > Cheers > > Ron Hi. It is not at all difficult, I have got rid of the supporting poles. Zoom up the image to a large size, and keep the brush size small. I find it looks better if you do not use a "Soft" Brush as they nearly always seem to create areas which look out of focus. You just need to make sure that you reset the "Pick Up" points fai...

ask about looping in matlab
Hi all! I have a trouble about this. I use loop function (for a : b ) for simulating my program but if the combination (b) get higher, the simulation get slowly. So, how to speed up the simulation with the loop? any function in matlab which can use for this case? Thank you On 5/26/2012 6:31 AM, azer hape wrote: > Hi all! > I have a trouble about this. I use loop function (for a : b ) for > simulating my program but if the combination (b) get higher, the > simulation get slowly. So, how to speed up the simulation with the loop? > any function in matlab which can use for this case? > Thank you No can help w/o knowing far more than you've posted...you haven't even told us what a, b are (altho that may not be terribly important, it is certainly a question). More than likely it's something to do with what is in the loop...common areas of trouble are not preallocating arrays and the like. Use the profiler to find a bottleneck. -- ...

How to get rid of warnings?
I have the maximum number of warnings during PHP development. How can I get rid of these warnings without turning them off in PHP? Here's the code I have: <form method="POST" action="eat.php"> <select name="lunch[ ]" multiple> <option value="pork">BBQ Pork Bun</option> <option value="chicken">Chicken Bun</option> <option value="lotus">Lotus Seed Bun</option> <option value="bean">Bean Paste Bun</option> <option value="nest">Bird-Nest Bun</option> </select> <input type="submit" name="submit"> </form> Selected buns: <br/> <?php foreach ($_POST['lunch'] as $choice) { print "You want a $choice bun. <br/>"; } ?> And I get: Warning: Invalid argument supplied for foreach() in C:\lighttpd\htdocs\index.php on line 17 Is there a way to give the 'lunch' variable a default value if undefined? Thank you. Lenard Redwood wrote: > I have the maximum number of warnings during PHP development. How can I > get rid of these warnings without turning them off in PHP? > > Here's the code I have: > > <form method="POST" action="eat.php"> > <select name="lunch[ ]" multiple> > <option value="pork">BBQ Pork Bun</option> > <option value="chicken">...

get rid of warning
After I download some software from a place like macupdate, I install it and then I try it out. But first I get a warning: "such and such app" was downloaded from the internet are you sure you want to open it? Yes, I *know* I downloaded it from the internet. I chose to. And yes, I *do* want to open it � that's why I double clicked it! Is there a place where I can choose to not have those warnings? (iMac, 2.66GHz, 4GB RAM, 10.5.7) -- Michael Fogler http://MichaelFogler.com In article <guitarist-6DC91C.08070308072009@netnews.insightbb.com>, Michael Fogler <guitarist@michaelfogler.com> wrote: > "such and such app" was downloaded from the internet are you sure you > want to open it? > > Yes, I *know* I downloaded it from the internet. I chose to. And > yes, I *do* want to open it � that's why I double clicked it! And some day, something will be downloaded without your knowledge or intent, and that something will be or contain malware. -- Member National Rifle Association Member American Civil Liberties Union Member Human Rights Campaign On 2009-07-08, Michael Fogler <guitarist@michaelfogler.com> wrote: > After I download some software from a place like macupdate, I install > it and then I try it out. But first I get a warning: > > "such and such app" was downloaded from the internet are you sure you > want to open it? > > Yes, I *know* I downloaded it from the i...

how can i do it in loop in matlab?
Hi, I have a sample date which is a 1000*8 matrix. i want to extract raws and c= olumns put them into new matrices, i need to assign the name of those new m= atrices automatically (names of matrices is s1,s1,...,s20), how can i do th= at? i used the following codes but it gave me an error! data=3Dload('case1.dat'); for i=3D1:20; for j=3D1:length(data) if data(j,1)=3D=3Di; eval['s' num2str(i)(j,:)]=3Ddata(j,:); end=20 end end Thank you very much. Best regards, Mathias ...

Matlab vector notation?
When I print the elements from 250 to 256 from this vector v(250:256) I get: ans = 0.0012 0.0009 0.0014 -0.0002 -0.0008 -0.0006 0.0004 but if I do v(256) I get: ans = 3.5559e-004 why do I get 3.5559e-004 instead of the correct: 0.0004?? "eksamor" <eksamor@yahoo.com> wrote: > When I print the elements from 250 to 256 from this vector v(250:256) I > get: > > ans = > 0.0012 0.0009 0.0014 -0.0002 -0.0008 -0.0006 0.0004 > > > but if I do v(256) I get: > > ans = > 3.5559e-004 > > why do I get 3.5559e-004 instead of the correct: 0.0004?? Because 3.5559e-4 is correct. 0.0004 is just rounded to four decimals for display. Actually 3.5559e-4 is itself rounded to four decimals for display. Matlab actually stores about 16 significant figures. If you enter the command "format long" at the command prompt, it will display a lot more than just four decimals. Matlab displays things differently when you display more than one number at a time--hence 0.0004 when it's with other numbers, and 3.559e-4 when its by itself. Now if you still think 0.0004 should be correct, then the question becomes why is Matlab storing 3.5559e-4? There are too many possible answers to that, but they all deal with the inherent limitations of double precision arithmetic. Any other language (symbolic languages like Maple & Mathematica excepted) would have the same problems with ma...

loop in Matlab #2
Hello, I am very stupid to ask this. I have a matrix A and want a new matrix B. I explained below what it is: A= 1 y1 2 y2 3 y3 4 y4 B= -2 y4 5 y5 I want to transform -1 y5 6 y6 ---------------------------------------------> 0 y6 7 y7 only X coordinates +1 y7 8 y8 and out put matrix +2 y8 9 y9 have this form +3 y9 10 y10 +4 y10 11 y11 12 y12 the provided info: index boundaries (upper and lower, here 4 & 10) and index to be set zero (here 6). I would like to know how to implement this in Matlab where upper, lower and index-set-zero should be variable. Can Anyone help me. Awaiting for your response. Thanks Somnath Karmakar wrote: > Hello, I am very stupid to ask this. I have a matrix A and want a new > matrix B. I explained below what it is: ....elided for brevity... > the provided info: index boundaries (upper and lower, here 4 & 10) > and index to be set zero (here 6). I would like to know how to > implement this in Matlab where upper, lower and index-set-zero should > be variable. Can Anyone help me. Awaiting for your response. Thanks >> % straight-ahead solution >> a=[(1:1...

Get rid of the title
I have a syntax which, when run, generates a IGRAPH for every subject I have (actually two graphs per subject). In the output file each IGRAPH gets a separate title which simply states "Interactive Graph". As having this title a few dozen times is redundant, I wondered whether I can put a command in my syntax to prevent SPSS from generating this title ... or, if this is not possible, maybe I could change it to something more sensible, again automated within the syntax? Thanks in advance! Cheers, Matthias If you want to get rid of this in the right hand side of the Viewer (rather than in the outline pane), you can suppress it with OMS. Here is an example. OMS select headings/if command='igraph'/destination viewer=no. <your igraph commands> OMSEND. "Interactive graph" will still appear in the outline, because it is the root for the Igraph output, but you won't see it in the main output. To get rid of it also in the outline would require an autoscript to promote the items below it and then delete it. HTH Jon Peck SPSS ...

Getting rid of warnings
Hello all, I usually try to get my code clean enough so that no warnings remain at compile time. So I'm annoyed by the 2 following warnings which I can't get rid of. Suggestions (in the form of code rewrite or #pragma) are welcome. Exemple 1: #define MAX_TRACES 100 int NbTraces=0; // Set somewhere else in the program void F(void) { int i, Idx[MAX_TRACES]; for (j=0; j<MAX_TRACES; j++) Idx[j]=0; // Doesn't change anything for (j=0; j<MAX_TRACES; j++) GetSomething(&Idx[j]); for (j=0; j<NbTraces; j++) i = Idx[j]; } The last line gives me: Warning: Local 'Idx' might not have been fully initialized. Obviously NbTraces<MAX_TRACES and anyway I fill up the Idx array with 0, so what is it complaining about ? Example 2: #define ADD(Frmt) { \ if (NULL==strchr(Frmt, '%')) sprintf(DimName, "%s/" Frmt, Server.Name);\ else sprintf(DimName, "%s/" Frmt, Server.Name, Port); ADD("Something"); ADD("SomePort%d"); The first add gives me: DimPpcServer.c:1126: warning: too many arguments for format And the 2nd one: DimPpcServer.c:1130: warning: too few arguments for format I understand the reason (the expansion of "%s/Something" on the 2nd line of the macro has an extra argument). Thanks -- Guillaume Dargaud http://www.gdargaud.net/ On 2012-03-05, Guillaume Dargaud <use_the_contact_form@www.gdargaud.net> wrote: > Hello all, > I usually try to get my code c...

How to get rid of cookies
Hi all, I am trying to get rid of an individual cookie. The OS is Windows ME. Seems like a cookie is slowing my computer to a crawl. When I go to Windows folder and open cookies I see just one file with extension .dat When I click on it, I get a message that another program uses it and therefore it is not accessible. So I changed the folder name from "Cookies" to "Junk", and the computer went back to normal speed. It seems that this is not the best solution though. Can anybody help me? Also, is there a way to search a group? I suspect that someone has already asked identical question. .. Les exlibris <exlibris@lafn.org> wrote in message news:<40AC414F.9000603@lafn.org>... > Hi all, > I am trying to get rid of an individual cookie. The OS is Windows ME. > Seems like a cookie is slowing my computer to a crawl. When I go to > Windows folder and open cookies I see just one file with extension .dat > When I click on it, I get a message that another program uses it and > therefore it is not accessible. So I changed the folder name from > "Cookies" to "Junk", and the computer went back to normal speed. It > seems that this is not the best solution though. Can anybody help me? Well, cookies are a big pain, but some of them you may want to keep if they are from websites where you have a password and log on frequently. It remembers your logon info so you don't have to type it in every time. The...

Web resources about - get rid of for loops/vectorization - comp.soft-sys.matlab

Vectorization with Parallel Composer XE
Noah Clemons gives a demonstration on High Productivity Vectorization Models at SC11 using Parallel Composer XE.

GitHub - jpatanooga/Canova: General Vectorization Lib for Machine Learning Tools
Canova - General Vectorization Lib for Machine Learning Tools

Cray - Wikipedia, the free encyclopedia
Cray Inc. ( NASDAQ : CRAY ) is an American supercomputer manufacturer based in Seattle, Washington . The company's predecessor, Cray Research ...

About - My lucky number 13
Well, a little bit of myself… My name is Diana Bajenaru. I’m a Romanian woman, and I’m proud of that, I like my Country very much. With all ...

Fortran Compiler Suites & Tools for Programmers on Intel Based Mac OS X Systems!
Fortran Compilers Debuggers and Software Development Tools for Intel Mac Programmers

Welcome to AMD Developer Central - AMD's Software Developer Portal
Home - Register - Log In Tools SDKs Libraries Samples & Demos Docs Zones Community Support AMD APP KernelAnalyzer AMD APP Profiler AMD CodeAnalyst ...

Following Instructions
Men don’t like to follow instructions. If you don’t believe me, come down to my garage and I will show you a box called “the extra parts box” ...

Statistical Modeling, Causal Inference, and Social Science
We just released Stan 1.1.1 and RStan 1.1.1 As usual, you can find download and install instructions at: http://mc-stan.org/ This is a patch ...

AUSTIN KLEON : BLOG : Posts tagged 'Flash'
... Lynda Barry last year. When my Powerbook crashed, I lost the original artwork forever. When I heard about Stanford’s VectorMagic online vectorization ...

robotics.benedettelli.com
The steps to get a portrait are three: make a photo (or load an image), extract the edges to obtain a serie of black lines on white background, ...

Resources last updated: 3/30/2016 12:40:45 PM