Search Results

Search found 1051 results on 43 pages for 'lebland matlab'.

Page 17/43 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Problem with assigning elements of a class array to individual variables in MATLAB

    - by Marc
    This is a bit of a duplicate of this question, this question, and this question, however those solutions don't work, so I'm asking mine. I've got an array of locally defined classes and I'd like to assign it to multiple, individual variables. This pattern doesn't work: %a is 2x1 of MyClass temp = mat2cell(a); [x,y] = temp{:}; %throws: ??? Insufficient number of outputs from right hand side of equal sign to satisfy assignment. Because temp is a single cell, with my 2x1 array in one cell, rather than a 2x1 cell array with one element of each of my original array in one cell. Any ideas?

    Read the article

  • Problem drawing a polygon on data clusters in MATLAB

    - by Hossein
    Hi, I have some data points which I have devided into them into some clusters with some clustering algorithms as the picture below:(it might takes some time for the image to appear) Each color represents different cluster. I have to draw polygons around each cluster. I use convhull for this reason. But as you can see the polygon for the red cluster is very big and covers a lot of areas, which is not the one I am looking for. I need to draw lines(ploygons) exactly around my data sets. For example in the picture above I want a polygon that is drawn exactly the same(and around) as the red cluster with the 3 branches. In other words, in this case I need a polygon with 3 branches to cover my red clusters not that big polygon that covers the whole area. Can anyone help me with this? Please Note that the solution should be general, because the clusters will change in each run of the algorithm, so it needs to be in a way that is general.

    Read the article

  • matlab fit exp2

    - by HelloWorld
    I'm unsuccessfully looking for documentation of fit function using exp2 (sum of 2 exponents). How to operate the function is clear: [curve, gof] = fit(x, y,'exp2'); But since there are multiple ways to fit a sum of exponents I'm trying to find out what algorithm is used. Particularly what happens when I'm fitting one exponent (the raw data) with a bit of noise, how the exponents are spread. I've simulated several cases, and it seems that it "drops" all the weight on the second set of coefficients, but row data analysis often shows different behavior. Does anyone have suggestions of documentation?

    Read the article

  • Matlab cell length

    - by AP
    Ok I seem to have got the most of the problem solved, I just need an expert eye to pick my error as I am stuck. I have a file of length [125 X 27] and I want to convert it to a file of length [144 x 27]. Now, I want to replace the missing files (time stamps) rows of zeros. (ideally its a 10 min daily average thus should have file length of 144) Here is the code I am using: fid = fopen('test.csv', 'rt'); data = textscan(fid, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); fclose(fid); %//Make time a datenum of the first column time = datenum(data{1} , 'mm/dd/yyyy HH:MM') %//Find the difference in minutes from each row timeDiff = round(diff(datenum(time)*(24*60))) %//the rest of the data data = cell2mat(data(2:28)); newdata=zeros(144,27); for n=1:length(timeDiff) if timeDiff(n)==10 newdata(n,:)=data(n,:); newdata(n+1,:)=data(n+1,:); else p=timeDiff(n)/10 n=n+p; end end Can somebody please help me to find the error inside my for loop. My output file seems to miss few timestamped values. %*********************************************************************************************************** Can somebody help me to figure out the uiget to read the above file?? i am replacing fid = fopen('test.csv', 'rt'); data = textscan(fid, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); fclose(fid); With [c,pathc]=uigetfile({'*.txt'},'Select the file','C:\data'); file=[pathc c]; file= textscan(c, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); And its not working % NEW ADDITION to old question p = 1; %index into destination for n = 1:length(timeDiff) % if timeDiff(n) == 10 % newfile(p,:) = file(n,:); % newfile(p+1,:)=file(n+1,:); % p = p + 1; % else % p = p + (timeDiff(n)/10); % end q=cumsum(timeDiff(n)/10); if q==1 newfile(p,:)=file(n,:); p=p+1; else p = p + (timeDiff(n)/10); end end xlswrite('testnewws11.xls',newfile); even with the cumsum command this code fails when my file has 1,2 time stamps in middle of long missing ones example 8/16/2009 0:00 5.34 8/16/2009 0:10 3.23 8/16/2009 0:20 2.23 8/16/2009 0:30 1.23 8/16/2009 0:50 70 8/16/2009 2:00 5.23 8/16/2009 2:20 544 8/16/2009 2:30 42.23 8/16/2009 3:00 71.23 8/16/2009 3:10 3.23 My output looks like 5.34 3.23 2.23 0 0 0 0 0 0 0 0 0 5.23 544. 42.23 0 0 0 3.23 Any ideas?

    Read the article

  • what is problem in the following matlab codes

    - by raju
    img=imread('img27.jpg'); %function rectangle=rect_test(img) % edge detection [gx,gy]=gradient(img); gx=abs(gx); gy=abs(gy); g=gx+gy; g=abs(g); % make it 300x300 img=zeros(300); s=size(g); img(1:s(1),1:s(2))=g; figure; imagesc((img)); colormap(gray); title('Edge detection') % take the dct of the image IM=abs(dct2(img)); figure; imagesc((IM)); colormap(gray); title('DCT') % normalize m=max(max(IM)); IM2=IM./m*100; % get rid of the peak size_IM2=size(IM2); IM2(1:round(.05*size_IM2(1)),1:round(.05*size_IM2(2))) = 0; % threshold L=length( find(IM2>20)) ; if( L > 60 ) ret = 1; else ret = 0; end

    Read the article

  • MATLAB: comparing all elements in three arrays

    - by sasha
    I have three 1-d arrays where elements are some values and I want to compare every element in one array to all elements in other two. For example: a=[2,4,6,8,12] b=[1,3,5,9,10] c=[3,5,8,11,15] I want to know if there are same values in different arrays (in this case there are 3,5,8)

    Read the article

  • How do I do multiple assignment in MATLAB?

    - by Benjamin Oakes
    Here's an example of what I'm looking for: >> foo = [88, 12]; >> [x, y] = foo; I'd expect something like this afterwards: >> x x = 88 >> y y = 12 But instead I get errors like: ??? Too many output arguments. I thought deal() might do it, but it seems to only work on cells. >> [x, y] = deal(foo{:}); ??? Cell contents reference from a non-cell array object. How do I solve my problem? Must I constantly index by 1 and 2 if I want to deal with them separately?

    Read the article

  • Problem using the find function in MATLAB

    - by Peter Etchells
    I have two arrays of data that I'm trying to amalgamate. One contains actual latencies from an experiment in the first column (e.g. 0.345, 0.455... never more than 3 decimal places), along with other data from that experiment. The other contains what is effectively a 'look up' list of latencies ranging from 0.001 to 0.500 in 0.001 increments, along with other pieces of data. Both data sets are X-by-Y doubles. What I'm trying to do is something like... for i = 1:length(actual_latency) row = find(predicted_data(:,1) == actual_latency(i)) full_set(i,1:4) = [actual_latency(i) other_info(i) predicted_info(row,2) ... predicted_info(row,3)]; end ...in order to find the relevant row in predicted_data where the look up latency corresponds to the actual latency. I then use this to created an amalgamated data set, full_set. I figured this would be really simple, but the find function keeps failing by throwing up an empty matrix when looking for an actual latency that I know is in predicted_data(:,1) (as I've double-checked during debugging). Moreover, if I replace find with a for loop to do the same job, I get a similar error. It doesn't appear to be systematic - using different participant data sets throws it up in different places. Furthermore, during debugging mode, if I use find to try and find a hard-coded value of actual_latency, it doesn't always work. Sometimes yes, sometimes no. I'm really scratching my head over this, so if anyone has any ideas about what might be going on, I'd be really grateful.

    Read the article

  • Suppressing a function's command window output in Matlab

    - by Ali
    A function I'm using has "display()" in it (or other things that display messages on command window), so it outputs a lot of things (x 1200) on command line when I run my code, which makes things hard to track and observe. Is there a way to suppress the output of this specific function? Ending the statement with semicolon obviously doesn't help.

    Read the article

  • Gaps In Plot Of Piecewise Function in Matlab

    - by eng_sub
    Hello, I want to plot a piecewise function, but I don't want any gaps to appear at the junctures, for example: t=[1:8784]; b=(26.045792 + 13.075558*sin(0.0008531214*t - 2.7773943)).*((heaviside(t-2184))-(heaviside(t-7440))); plot(b,'r','LineWidth', 1.5);grid on there should not be any gaps appearing in the plot between the three intervals , but they do. I want the graph to be continueous without gaps. Any suggestions on how to achieve that. Thanks in advance.

    Read the article

  • Matlab matrix translation and rotation multiple times

    - by pinnacler
    I have a map of individual trees from a forest stored as x,y points in a matrix. I call it fixedPositions. It's cartesian and (0,0) is the origin. I would like 0/360 degrees to be the top of the screen and 90 degrees to be to the right. Given a velocity and a heading, i.e. .5 m/s and 60 degrees (2 o'clock equivalent on a watch), how do I rotate that x,y points, so that the new origin is centered at (.5cos(60),.5sin(60)) and 60 degrees is now at the top of the screen? Then if I were to give you another heading and speed, i.e. 0 degrees and 2m/s, it should calculate it from the last point, not the original fixedPositions origin. I've wasted my day trying to figure this out. I wish I took matrix algebra but I'm at a loss. I tried doing cos(30) and even those wouldn't compute correctly, which after an hour I realize were in radians.

    Read the article

  • matlab image processing 3d

    - by jaysean
    i have 100 b&w image of smthing.the probllem is i want to scan each image in 0&1 formatin mby n format and then place each image to one over one and again scan and save them in mbynby100 form. how i do this and from where i should start _jaysean

    Read the article

  • MATLAB submatrix over variable dimensions

    - by rlbond
    I have a variable dimension matrix, X. I want a function that will get the first half of X in one dimension. I.E., I want something like this: function x = variableSubmatrix(x, d) if d == 1 switch ndims(x) case 1 x = x(1:end/2); case 2 x = x(1:end/2, :); case 3 x = x(1:end/2, :, :); (...) end elseif d == 2 switch ndims(x) case 2 x = x(:, 1:end/2); case 3 x = x(:, 1:end/2, :); (...) end elseif (...) end end I'm not quite sure how to do this. I need it to be fast, as this will be used many times in computation.

    Read the article

  • plot 3D and combine in matlab

    - by George
    Hello ,i have this matrix "experiment=2*rand(npoints,3)-1". I want to plot in in 3D,so i use "mesh(experiment)". How can i take red points in my plot? Also,i want to implement in the above plot , a sphere with radius 1 at 0,0,0. I did : mesh(experiment) hold on [x,y,z]=sphere; r=1; mesh(r*x,r*y,r*z) hold off but 1) i am not taking radius 1 2) the figures just showing in the same graph but don't combine Thanks

    Read the article

  • Problem with averaging corrupted images to eliminate the noise in MATLAB

    - by Mertie Pertie
    I want to average some .jpg images which are corrupted by zero-mean Gaussian additive noise. After searching around, I figured out to add the image matrices and divide the sum by the number of matrices. However, the resultant image is totally black. Normally when the number of image increases then the resultant image gets better. But when I use more images it gets darker. I am using 800x600 black and white .jpg images. Here is the script I used: image1 = imread ('PIC1.jpg'); image2 = imread ('PIC2.jpg'); image3 = imread ('PIC3.jpg'); image4 = imread ('PIC4.jpg'); sum = image1 + image2 + image3 + image4; av = sum / 4; imshow(av);

    Read the article

  • Edit axes to an image in matlab ?

    - by ZaZu
    Hello, I would like to edit the axes in my series of images being displayed .. This is how my image looks like : As you can see, it starts from 0 to ~~500 from top to bottom, can I invert that ? Plus I want to mirror the image being shown, so that it starts from left to right ... Or if its possible, let the axes show from right to left ? Thanks !

    Read the article

  • Finding many local max in an image (using MatLab)

    - by wenh42
    How do you go about figuring our multiple max in a 2D image where the max aren't necessarily all the same height? I have found that the imregionalmax(), imextendedmax(), and findpeaks() functions aren't necessarily that helpful because they give many local max that are really just maxes within the background noise. I tried bw=arrayimdilate(array,[1 1 1; 1 0 1; 1 1 1]) but that also is kind of limited for the same reasons (same thing with expanding the matrix that it uses). I'd definitely appreciate some help..

    Read the article

  • Replace some column values depending on a condition, MATLAB

    - by darkcminor
    I have a matrix like A= 4.0000 120.0000 92.0000 0 0 37.6000 0.1910 30.0000 10.0000 168.0000 74.0000 0 0 38.0000 0.5370 34.0000 10.0000 139.0000 80.0000 0 0 27.1000 1.4410 57.0000 1.0000 139.0000 60.0000 23.0000 846.0000 30.1000 0.3980 59.0000 5.0000 136.0000 72.0000 19.0000 175.0000 25.8000 0.5870 51.0000 7.0000 121.0000 0 0 0 30.0000 0.4840 32.0000 I want to replace the values of the first column that are greater than '5' to 0, also in the second column if the values are in range 121-130 replace them by 0, if they are in range 131-140 replece by 1, 141-150 by 2, 151-160 by 3... so the result matrix would be A= 4.0000 0.0000 92.0000 0 0 37.6000 0.1910 30.0000 0.0000 4.0000 74.0000 0 0 38.0000 0.5370 34.0000 0.0000 1.0000 80.0000 0 0 27.1000 1.4410 57.0000 1.0000 1.0000 60.0000 23.0000 846.0000 30.1000 0.3980 59.0000 5.0000 1.0000 72.0000 19.0000 175.0000 25.8000 0.5870 51.0000 0.0000 0.0000 0 0 0 30.0000 0.4840 32.0000 How to acomplish this? I was trying something like counter=1; for i = 1: rows if A(i,1) > 5 A(i ,1) = 0; end if A(i,2) > 120 && A(i,2) < 130 A(i ,2) = 0; end counter = counter+1; end Using a case could do the trick?

    Read the article

  • Averaging corrupted images to eliminate the noise in Matlab

    - by Mertie Pertie
    Hi all As you can get it from the title, I want to average some .jpg images which are corrupted by zero-mean Gaussian additive. After searching over internet, I figured out to add image matrices and divide the sum by the # of matrices. However the resultant image is totally black. Normally when the number of image increases then the resultant image gets better. But When I use more images it gets darker. I am using 800x600 black and white images with .jpg ext Here is the script I used; image1 = imread ('PIC1.jpg'); image2 = imread ('PIC2.jpg'); image3 = imread ('PIC3.jpg'); image4 = imread ('PIC4.jpg'); sum = image1 + image2 + image3 + image4; av = sum / 4; imshow(av); Thanks in advance

    Read the article

  • how to use summation in matlab???

    - by lucky
    i have a randomly generated vector say A of length M say A=rand(M,1) and also i have function X(k)=sin(2*pi*k) how would i find Y(k) which is summation of A(l)*X(k-l) as l goes from 0 to M ... assume any value of k... but answer should be summation of all M+1 terms

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >