f



Basic matlab question

It is an easy question I guess but I need help
I have three columns: day, hour and data
exemple:

1  4    22
1  8    120 
1  12   510
1  17   245
2  3    37
2  10   311
3  14   362
3  18   131
3  21   26

I have another table with max and min hour for each day and I would like to keep just the data between that max and min and transform the rest in NaN. Each day have different number of data. Can anyone help me?
0
8/20/2009 10:51:04 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
908 Views

Similar Articles

[PageSpeed] 0

On Aug 20, 12:51=A0pm, Fabian <fabianbat...@hotmail.com> wrote:
> It is an easy question I guess but I need help
> I have three columns: day, hour and data
> exemple:
>
> 1 =A04 =A0 =A022
> 1 =A08 =A0 =A0120
> 1 =A012 =A0 510
> 1 =A017 =A0 245
> 2 =A03 =A0 =A037
> 2 =A010 =A0 311
> 3 =A014 =A0 362
> 3 =A018 =A0 131
> 3 =A021 =A0 26
>
> I have another table with max and min hour for each day and I would like =
to keep just the data between that max and min and transform the rest in Na=
N. Each day have different number of data. Can anyone help me?

How does this look?
A =3D [1  4    22
1  8    120
1  12   510
1  17   245
2  3    37
2  10   311
3  14   362
3  18   131
3  21   26 ];
%%%B contains max/min vals for each day
B =3D [5 15; 5 10; 15 20];
%%%
tmp2 =3D [];
for i=3D1:max(A(:,1))
  tmp =3D A(A(:,1) =3D=3D i,:);
  tmp2 =3D [tmp2;tmp(:,2) < B(i,1) | tmp(:,2) > B(i,2)];
end
A(logical(tmp2),:) =3D NaN;
%%%%%%%%%%%%%%%%%%%%%%%%%
A =3D
   NaN   NaN   NaN
     1     8   120
     1    12   510
   NaN   NaN   NaN
   NaN   NaN   NaN
     2    10   311
   NaN   NaN   NaN
     3    18   131
   NaN   NaN   NaN

-Nathan
0
ngreco32 (530)
8/20/2009 8:23:04 PM
One liner solution

% B(A(:,1),1) is min hour of the day
% B(A(:,1),2) is max hour of the day

A(A(:,2)<B(A(:,1),1) | A(:,2)>B(A(:,1),2),:)=NaN

% Bruno
0
b.luong5955 (6401)
8/20/2009 9:56:04 PM
Thank you Nathan. Your answer really helped.
0
8/21/2009 12:31:52 AM
Reply:

Similar Artilces:

basic MATLAB question #2
I have a script where I input specific columns from a ascii file and perform a function on them. Is it possible to set the name, of the file I import, as some kind of variable so that I don't have to write the filename over and over for each time I import it? This is how I do it now: x = dlmread('asciifile', '\t', 'A1..A100'); y = dlmread('asciifile', '\t', 'B1..B100'); I want to be able to do something like this: filename = 'asciifile' x = dlmread('filename', '\t', 'A1..A100'); y = dlmread('filename', '\t', 'B1..B100'); xlswrite('fielanmeoutput.xls', out, 'output', 'A1') xlswrite('fielanmeoutput.xls', out, 'output', 'B1') Kim <kili@kth.se> wrote in message <1484051125.10969.1258114196390.JavaMail.root@gallium.mathforum.org>... > bump I am not quite sure this is what you need but have you looked at uigetfile( ... ); and its mate uiputfile( ... ); Regards Dave Robinson Just omit the quotes when passing the filename to the function: filein = 'asciifile'; x = dlmread(filein' '\t', 'A1..A100'); y = dlmread(filein, '\t', 'B1..B100'); fileout = 'fielanmeoutput.xls'; xlswrite(fileout, out, 'output', 'A1'); xlswrite(fileout, out, 'output', 'B1'); bump On Nov 13, 10:00=A0am, Kim <k...@kth.se> wrote: > Th...

Some basic questions about MATLAB operation
Hi, I have recently started using MATLAB for a DSP and a Communication Theory class. I have some questions about how MATLAB does some things. 1. To plot a graph, say a sinusoid, I always do this: t=0:.1:10; a=sin(t); plot(t,a) What does MATLAB do to generate the data for the points that are not in increments of .1? for example sin(1.13)? Does it interpolate to generate the graph? Is this sinusoid only valid for .1 increments? In fact, a function in MATLAB is inherently discrete, but we use it to model continuous functions (its 'domain' is actually only 101 samples)? 2. I'm having trouble mixing up the indices of the array (1..101 for t matrix) and the actual values (t(1)=0 t(1)=0.1, etc.)I am doing a lot of shifting of functions (such as f(x) = x -> f(x-2) = x-2) and this is messing me up, I usually get the error, "indices must be positive or logicals.." Mathematically, it makes sense to compute f(x(1)-2) for x(1)=1, but it doesn't make sense in MATLAB to ask for f(-1). This brings me to the question of what is a reasonable matrix size for x. -100:.1:100 ? Does it depend on the precision you need? Is there a 'convention' used to model functions? 3. I had a misconception that MATLAB was very close to mathematical notation. In fact, you have to interpret a lot when using it, often going back to the theory to make sure computations make sense. So am I using it the 'right' way. Usually only crunching huge amounts of numbers? I know...

Basic Matlab Question #3
I have a 32 x 1300 2D array, lets call it S. I know I can pick off a particular row with the following argument: A = S(1,:); which gives me a 1 x 1300 array from the first row of the 2D array. I want every row assigned to a new indexed array, so I would start off with for n = 1:rows A(n) = S(n,:); end This doesn't work because of a dimensional mismatch. I'm not really trying to define a dimension but simply declare a unique identifier. How am I able to assign rows such that I can put them in A(1), A(2), etc., all with the dimension 1 x 1300. Thanks! On Nov 16, 3:46=A0pm, "James Carter" <jim...@msn.com> wrote: > I have a 32 x 1300 2D array, lets call it S. =A0I know I can pick off a p= articular row with the following argument: A =3D S(1,:); which gives me a 1= x 1300 array from the first > row of the 2D array. =A0I want every row assigned to a new indexed array,= so I would start off with > > for n =3D 1:rows > A(n) =3D S(n,:); > end > > This doesn't work because of a dimensional mismatch. =A0 I'm not really t= rying to define > a dimension but simply declare a unique identifier. =A0 How am I able to = assign rows > such that I can put them in A(1), A(2), etc., all with the dimension 1 x = 1300. =A0 > > Thanks! So essentially you want A to be a 32x1 vector? You're trying to access single elements of A, yet you're trying to put a 1x1300 length vector into that single element. You wou...

Slope related basic MATLAB question
Dear all, I need to write a small program which to test whether a line (position vector) does strictly clockwise or CCLW movement. I tried to use atand to find the angle, but it could jump from negative to positive value when it pass thought 90 deg, it will have the same thing if I use slope method. However, the motion does not have to cut at 90 deg, it could jump from 89 to 91. Then a big slope jump could happen. Any idea please Thanks ...

Importing multiple text files into MATLAB (basic question)
Hi All, I recently started a summer job, and was hoping that someone on this forum could provide me with a little assistance. I've used MATLAB in the past in a numerical analysis class, but do not have all that much experience yet. I have a data set consisting of around 50 text (.txt) files. Each text files contains multiple matrices. An example of how one of these matrices is formatted follows: "Gazepoint Trace Data File, 09:46:08 03/05/2002 22 Scene Type: text 1024 768 C:\Eyegaze\penguin.txt Raw Gazepoint Data (60 Hz Sampling Rate): samp Eye Gazepoint Pupil Eyeball-Position Focus Fix indx Found X Y Diam X Y Z Range Indx (t/f) (pix) (pix) (mm) (mm) (mm) (mm) (mm) 0 1 628 332 3.46 -20.5 -2.0 15.1 585.0 0 1 1 635 338 3.47 -20.6 -2.0 14.1 585.0 0 (a couple thousand lines of data like this...) Fixation Data: (60 Hz Sampling Rate) fix Fixation Sac Fix Fix indx X Y Dur Dur Start (pix) (pix) (cnt) (cnt) Samp 0 644 343 0 11 0 1 640 347 7 8 18 2 474 235 203 16 229 (a couple hundred lines like this...)" I would like to write an m-file (or do whatever I need to do) to import both matrices rom each of the fifty text files. into my workspace so that I can run machine learning algorithms on them. I have tried to look at the documentation for importing .txt data files...

Matlab engine with matlab R2010b
Hello All, I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡ ...

Few matlab questions
Hello, I have this questions for you. I hope some one can help me. So I have a background image and I want to insert another image over it. A ball for example. But this ball get on top of the background and it streches to full screan. 1) How to make matlab plot a picture in its original size. I don`l want to be stretched. 2) My ball picture is a PNG file so i need not to show the transparent pixels. I used: A = imread('ball.png','BackgroundColor','none'); image(A) but it isn`t working.. 3) Can I load an animation or sound in the plot figure. For example if we have a goal then some fireworks appears or sound? This is every thing I have to ask. Than you very much if some on can help me! You might have to overwrite the original pixels like this demo does: % Read in a standard MATLAB gray scale demo image. folder = fullfile(matlabroot, '\toolbox\images\imdemos'); baseFileName = 'mandi.tif'; fullFileName = fullfile(folder, baseFileName); % Get the full filename, with path prepended. fullFileName = fullfile(folder, baseFileName); if ~exist(fullFileName, 'file') % Didn't find it there. Check the search path for it. fullFileName = baseFileName; % No path this time. if ~exist(fullFileName, 'file') % Still didn't find it. Alert user. errorMessage = sprintf('Error: %s does not exist.', fullFileName); uiwait(warndlg(errorMessage)); return; end end grayImage1 = imre...

Spawning matlab from within matlab
Hello all, I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes. Any suggestions? Joe ...

Creating DLL in Matlab and using them in Matlab?
Hi, is it possible to create dll in Matlab and then using it in other Matlab apllication? I've made a simple function and put it into dll. But when I try to use this library in other apllication written in matlab it doesn't works. Any idea? -- Pozdrawiam, e-Shrek hi e-shresk, I once created a matlab dll, and called it in c code. it worked. I guess you have to check whether you dll was built correctly or not. ps. why don't u call matlab function directly? Dnia Mon, 26 Oct 2009 07:19:04 +0000 (UTC), Jun napisa�(a): > hi e-shresk, > > I once created a matlab dll, and called it in c code. it worked. Hmmm. The function is very simple: ========================== function var_o = testlib(var_i) if var_i == '1', var_o = 'jest'; else var_o = 'brak'; end ========================== Compilation: mcc -W lib:xlib -T link:lib testlib After it, I have *.dll *.lib *.h Tryin' to load library: loadlibrary('xlib.dll','xlib.h'); The result is: Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(...) > In loadlibrary at 394 Where is the problem? > ps. why don't u call matlab function directly? I have a pack of functions that I wouldlike to use with few different matlab compiled programs. -- Pozdrawiam, e-Shrek On Oct 26, 1:47=A0pm, e-Shrek <e-Shrek.wyt...@wytni...

embedded matlab function MATLAB R2009a
I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked. Thanks to the contribution from above! ...

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! ...

Problems calling from Matlab a Matlab compiled dll
Hi, I'm trying to make a dll from an m-file and use the dll function calling from the workspace or from an m file using 2008A version: Step 1 function [output] = addizione (a,b) output = a+b; end Step 2 I compile it with matlab compiler mcc -l addizione I obtain addizione.dll, .lib, .h etc Step 3 load the newly created addizione.dll loadlibrary ('addizione','addizione') with the following warnings: Type 'LARGE_INTEGERPtr' was not found. Defaulting to type voidPtr. Found on line 20522 of input from line 7673 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_TREEITEMPtr' was not found. Defaulting to type voidPtr. Found on line 20944 of input from line 8095 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETPAGEPtr' was not found. Defaulting to type voidPtr. Found on line 21328 of input from line 8479 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_PSPPtr' was not found. Defaulting to type voidPtr. Found on line 21329 of input from line 8480 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETHEADERPtr' was not found. Defaulting to type voidPtr. Found on line 21351 of input from line 8502 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'LARGE_INTEGER' was not found. Defaulting to type error. Found on line 21610 of input from line 8761 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'L...

Matlab modeling question
ok basically i have a fat equation that i want to graph in matlab and the largest issue is i get an error because one of the variables i want on my X axis is in the denominator. I may be going about this wrong but i set it up as a 1D array of a range of variables. because this array is in the denominator and division by a matrix is undefined i cant get it to graph. so my long question is how do i graph Y vs X when the equation is Y=Z/(X+B) Z and B are constants for all purposes really and X is a 1D array(unless theres a different way to display it for a range of values i want.) Any help on this would be great thanks! John wrote: > ok basically i have a fat equation that i want to graph in matlab and > the largest issue is i get an error because one of the variables i want > on my X axis is in the denominator. I may be going about this wrong but > i set it up as a 1D array of a range of variables. because this array > is in the denominator and division by a matrix is undefined i cant get > it to graph. so my long question is how do i graph Y vs X when the > equation is Y=Z/(X+B) Z and B are constants for all purposes really and > X is a 1D array(unless theres a different way to display it for a range > of values i want.) Any help on this would be great thanks! Y = Z ./ (X + B) ...

creating GUI in matlab out of some programs written in matlab
I have written some code in matlab for my application. I want to make a graphical interface so that an user can easily use my code. I do not know, how to link my code or a particular function when user clicks on a particular button. I mean, how to assign a function written by me to a push button so that it will execute the function. And how to give the input to my function and get output after executing the particular function. I am quiet familiar with matlab code. But I am absolutely new with GUI in matlab. Please help me to deal with the above problem. On 4/12/2011 12:37 AM, sk maidul haque wrote: > I have written some code in matlab for my application. > I want to make a graphical interface so that an user can easily use my code. > I do not know, how to link my code or a particular function > when user clicks on a particular button. I mean, how to assign a > function written by me to a push button so that it will execute the function. > And how to give the input to my function and get output after > executing the particular function. > I am quiet familiar with matlab code. But I am absolutely new with > GUI in matlab. Please help me to deal with the above problem. Use GUIDE to make the gui. It is very simple and powerful to use. I use it all the time for my school projects and HW's. I know some prefer to code the thing by hand, but I prefer GUIDE. When you add a button in GUIDE, it will create a callback stub for you automatically...

Matlab 2011: matlab coder (build failed)
When I create a MATLAB Coder Project and try to convert this function: ------------------------- function y = myResampler(x,m,n) %#codegen fsVec = [8000 16000 32000 48000]; targetFsVec = [8000 16000 32000 48000]; fs = fsVec(m); targetFs = targetFsVec(n); y = resample(x,targetFs,fs); ------------------------- to C-code I get a build error saying: coder -build resamplerproj.prj ??? The upsample factor P must be constant. Error in ==> myResampler Line: 12 Column: 5 Code generation failed: Open error report. But I want to be able to resample x using a variable P/Q ratio. Is this just a limitation of Matlab Coder or am I doing something wrong?? John wrote: > When I create a MATLAB Coder Project and try to convert this function: > > ------------------------- > function y = myResampler(x,m,n) %#codegen > > fsVec = [8000 16000 32000 48000]; > targetFsVec = [8000 16000 32000 48000]; > > fs = fsVec(m); > targetFs = targetFsVec(n); > > y = resample(x,targetFs,fs); > ------------------------- > > to C-code I get a build error saying: > > coder -build resamplerproj.prj ??? The upsample factor P must be > constant. Error in ==> myResampler Line: 12 Column: 5 Code generation > failed: Open error report. > > > > But I want to be able to resample x using a variable P/Q ratio. > > Is this just a limitation of Matlab Coder or am I doing something wrong?? Apparently it's a limitation of RESAMPLE ...

Debugging matlab with emacs and avoiding matlab editor
I am using matlab mode in emacs to run matlab without using any of the matlab buildt in GUI. However, when I use debugging eg. "dbstop error" the matlab editor opens. Does anyone know how to avoid this? -- Associate Prof. Ph.D Torben Knudsen Mobile : (+45) 2787 9826 Section of Automation and Control, Direct : 6 8694 Department of Electronic Systems, Email : tk@es.aau.dk Aalborg University Fredrik Bajersvej 7 DK-9220 Aalborg � Denmark On 10 Sep, 13:48, Torben Knudsen <t...@es.aau.dk> wrote: > I am using matlab mode in emacs to run matlab without using any of the > matlab buildt in GUI. =A0However, when I use debugging eg. "dbstop > error" the matlab editor opens. =A0Does anyone know how to avoid this? Don't know how to help, but this reminds me of moving from matlab 4 to matlab 5 on HP-UX aeons ago. As I remember, matlab 5 was the first version based on the matlab GUI, and that particular feature, that the editor appeared in debug mode, was really annoying. Almost put me off matlab alltogether. Haven't seen or heard about anybody working matlab like that for the past, what, 12-15 years? Just out of curiosity, what version of matlab (and emacs) do you use? Rune Rune Allnor <allnor@tele.ntnu.no> writes: > On 10 Sep, 13:48, Torben Knudsen <t...@es.aau.dk> wrote: >> I am using matlab mode in emacs to run matlab without using any of the >> matlab buildt in GUI. �However, when I use debugging eg. &q...

Why does Matlab do this
What is happening when I type rand(1:10) at the command line? Matlab goes into a 10 minute spin - what's going on? Thanks "Robert" wrote in message <j64asi$5v4$1@newscl01ah.mathworks.com>... > What is happening when I type > rand(1:10) > at the command line? > > Matlab goes into a 10 minute spin - what's going on? > Thanks Hi Robert, You're create a 10-D array with that syntax. Do you just want a vector of 10 uniformly distributed random numbers. x = rand(10,1); % or x = rand(1,10); Wayne Hi Wayne, You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! Thanks for the explanation. Robert "Robert" wrote in message <j64d2h$dvo$1@newscl01ah.mathworks.com>... > Hi Wayne, > You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! > Thanks for the explanation. > Robert That's fine. Welcome to MATLAB!!! If that's the worst memory-intensive mistake you ever make, you'll be fine :) I've done much, much worse. Wayne ...

Matlab Challenge Question
Good day, I am fairly new to matlab and have been stumped for a couple of hours trying to figure out a problem. I am trying to generate 20 numbers between 2 and 24 to represent the cost of maintaining a peice of equipment over between 2007 and 2026 respectively (20 years) with 2 representing the costs as of 2007 and 24 representing the projected costs in 2026. Although I was able to generate the numbers, I was not happy with the result because all the numbers were totally sequential. ..2, 3, 4 for 2007, 2008, 2009 etc. Can anyone kindly give me some insights as to how to formulate this in matlab. I anticipate the costs rising somewhat linearly till 2027 after which the costs will start to rise rapidly. Thanks in Advance YEARS = 2007:2026; COST = linspace(2,24,20); plot(YEARS,COST) "Al " <spsbe2004@yahoo.com> wrote in message <h9pe80$2kt$1@fred.mathworks.com>... > Good day, > > I am fairly new to matlab and have been stumped for a couple of hours trying to figure out a problem. > > I am trying to generate 20 numbers between 2 and 24 to represent the cost of maintaining a peice of equipment over between 2007 and 2026 respectively (20 years) with 2 representing the costs as of 2007 and 24 representing the projected costs in 2026. Although I was able to generate the numbers, I was not happy with the result because all the numbers were totally sequential. ..2, 3, 4 for 2007, 2008, 2009 etc. Can anyone kindly give me some insights as to...

code of matlab 7a not working in matlab 2009
I wrote a code in matlab 7a andand it was working over there then i changed computer which was having matlab realease 2009a and it is not working If i install Matlab 7 release 14, will my code work again thanks "moonman" wrote in message <ipmsl7$23v$1@fred.mathworks.com>... > I wrote a code in matlab 7a andand it was working over there > then i changed computer which was having matlab realease 2009a and it is not working > > If i install Matlab 7 release 14, will my code work again thanks Can you be more specific about the fact that your code is not working in 2009a but worked in 2007a? It would be helpful if you could narrow down what is not working in 2009a and provide error messages. Wayne ok thanks wyne i will send error message after some hours ...

Matlab Question #10
Hallo I would really like to ask for your help as I am new in Matlab. I have a Matrix b=[5 8 10 2 3 7 8 6 3 10] And c=2*b What I would like to do is the following: I would like the values of c that are greater than 7 (in this case 7 values). From these values of c that are greater than 7 I want to keep one (any of these) equal to 7 (so reducing the value exactly to 7) by converting matrix b. So basically I would like to transform matrix b in order to get one value of c,which is greater than 7, equal to 7 and the rest ,that are greater than 7, less than seven. I would really appreciate any help Thank you! On 2010-03-01 00:29, George wrote: > Hallo > I would really like to ask for your help as I am new in Matlab. > I have a Matrix b=[5 8 10 2 3 7 8 6 3 10] > And c=2*b > What I would like to do is the following: > I would like the values of c that are greater than 7 (in this case 7 values). > From these values of c that are greater than 7 I want to keep one (any of these) equal to 7 (so reducing the value exactly to 7) by converting matrix b. > > So basically I would like to transform matrix b in order to get one value of c,which is greater than 7, equal to 7 and the rest ,that are greater than 7, less than seven. > I would really appreciate any help > Thank you! c(c>7)=7; Like this? On 2010-03-01 00:29, George wrote: > Hallo > I would really like to ask for your help as I am new in Matlab. > I have a Matrix b=[5 8 10 2 3 7 8 6...

Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors to the MATLAB Central File Exchange. Look for your favorite contributors on our File Exchange Author Profile page. You can read their profiles and see pictures: <http://www.mathworks.com/matlabcentral/reports/fileexchange/allProfiles/> In a random drawing, we recently awarded MATLAB jackets to three File Exchange authors with profile pages: Michele Giugliano, Andrey Egin, and Denis Gilbert. You can win a jacket, too. Just submit a new file to the File Exchange or update your author profile by December 2003 for a chance to win one of four MATLAB jackets. See the jacket below: <http://www.mathworks.com/matlabcentral/images/jeff3.jpg> Here are some interesting File Exchange facts: - Since its inception in 2001, visitors have downloaded more than 1.25 million submissions from the File Exchange. - In September 2003 alone, visitors downloaded 80,085 files, an average of 2670 a day! .... what if the prize was a free copy of the next version of Matlab :-) majb Min Poh wrote: ....or an offer for employment... aj "bourassa" <bourassa-m@rmc.ca> wrote in message news:3f9d507d$1@rmcnt03a.rmc.ca... > ... what if the prize was a free copy of the next version of Matlab :-) > > majb > > Min Poh wrote: > ...

MATLAB questions help
Need help with these questions..any help is much appreciated.... Here is my code for the first part if its of any use but I need help with the questions.. explanation for the answers would be great.thanks 1) Write the Matlab code. The routine syntax should be [A,p,k]=partition5(A,low,upp) The output p is the value of the pivot and k the index of the pivot. The latter is required in order to know what the &#8216;left&#8217; and &#8216;right&#8217; vector parts are. 2) Sketch the situation at the end of the loop for the two cases that the pivot happens to be the smallest or largest vector element. Are these cases treated correctly by your code? 3) As mentioned before, the &#8216;unsorted yet&#8217; part of the vector is indicated by the indices running from i to j. Is it possible that i equals j? Is your code treating this correctly? 4) Check your routine for several vectors A .Consider also examples with multiple vector elements having the same value (including the pivot element ). 5) a) What are the indices of the left and right part after the partitioning? b) When can the recursion be stopped? file: function[A,P,k] = partition5(A,low,upp) % syntax: function [A,P,k]=partition5(A,low,upp) % % A function to take a pivot and sort lower values to the left and all % higher values to the right % % Input % A: vector to be sorted % low: lower index of part of vector A to be sorted % upp: upper index of part of vector A to be sorted % O...

Matlab homework question
Little Help im stuck on this1! We have a black disk within a white box. The value of the background is zero and the value inside the disk with a diameter of 2 cm is 1. The side of the square is 12 cm. The center of the disk is located at (3, 2) cm, assuming the center of the square is the origin. Write a Matlab program to create a matrix representing this object. On Oct 1, 9:50=A0pm, behzad Safinejad <behzad.brya...@gmail.com> wrote: > Little Help im stuck on this1! =A0 =A0We have a black disk within a white > box. =A0The value of the background is zero and > the value inside the disk with a diameter of 2 cm is 1. The side of > the square is 12 cm. > The center of the disk is located at (3, 2) cm, assuming the center of > the square is the > origin. =A0Write a Matlab program to create a matrix representing this > object. ---------------------------- Usually black is 0 and white is 1 - the opposite of what you have. You could use a colormap to display them in reverse without altering the underlying image values. Check out the colormap() function. Have you looked at the zeros() and ones() functions? Have you checked the File Exchange on the MATLAB web site for circle related submissions? Doesn't look too hard. Worst case you could just do a brute force pixel by pixel scan seeing if the pixel is inside the formula for the circle. I'm sure you can figure out the formula for a circle centered at some point. Since this is clearly ho...

how to do this in matlab
Number of column: 5 Vector A: [ 2 4 6 7 8 ] Vector B : [ 5 7 8 10 1] Choice = 1 : Find the highest value Vector A : 8 Vector B: 10 The highest value : 10 Choice = 2 : Find the lowest value Vector A : 2 Vector B: 1 The highest value : 1 Choice = 3 : Find the average value of : Vector A Vector B "Syamil " <syamilsaid@gmail.com> wrote in message <inq3g8$hhd$1@fred.mathworks.com>... > Number of column: 5 > Vector A: [ 2 4 6 7 8 ] > Vector B : [ 5 7 8 10 1] > > Choice = 1 : Find the highest value > Vector A : 8 > Vector B: 10 > The highest value : 10 > > Choice = 2 : Find the lowest value > Vector A : 2 > Vector B: 1 > The highest value : 1 > > Choice = 3 : Find the average value of : > Vector A > Vector B Type in matlab: doc min doc max doc mean ...

Web resources about - Basic matlab question - comp.soft-sys.matlab

German question - Wikipedia, the free encyclopedia
"Kleindeutschland" redirects here. For the neighborhood in New York City, see Little Germany, Manhattan . 1820 map of Central Europe showing ...

To daylight save or not to daylight save? That is the question
Australians are perfectly happy to shrug over boring, vital issues – but force our free citizenry to occasionally adjust their clocks? That, ...

To daylight save or not to daylight save? That is the question
Australians are perfectly happy to shrug over boring, vital issues &ndash; but force our free citizenry to occasionally adjust their clocks? ...

To SQL or NoSQL? That’s the database question
It's a tangled, database web out there. (credit: Getty Images) Poke around the infrastructure of any startup website or mobile app these days, ...

Question of the Day: Coolest engine-displacement badge ever?
Filed under: Etc. , Automotive History During the engine-displacement arms race, car companies vied for the raciest-looking numerical badges. ...

Yahoo!: SunTrust to Host Call with Proxy Advisory Group on Starboard Questions
SunTrust Robinson Humphrey ’s Robert Peck , who has beaten the drum louder than anyone else on the Street about the lack of responsiveness of ...

Apple responds to FBI iPhone hack, but questions remain
Yesterday, the FBI announced that it had managed to break into the San Bernardino shooter's iPhone sans help from Apple. The iPhone manufacturer ...

A Student’s Question About the Minimum Wage
(Don Boudreaux) Tweet Last night in my Principles of Microeconomics class at George Mason University (ECON 103) my students and I discussed ...

​The 10 oddest job interview questions
On your toes, applicants: What's your game plan if you find a penguin in the freezer?

Nearly retired? 3 questions to ask
No matter what happens to the markets, retirees should ask these three key questions to keep money safe, say financial advisors.

Resources last updated: 3/31/2016 5:37:16 AM