Search Results

Search found 4643 results on 186 pages for 'matlab deployment'.

Page 23/186 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Basic FreeMat/MATLAB syntax - dimension error

    - by 0x90
    I am using FreeMat, and I have an RGB picture which is a 3D matrix contains the columns and rows of the pictures and the RGB values for each pixel. Since there is not an intrinsic function to convert RGB picture to YIQ, I have implement one. I came up with this code: Assume I have a 3D array, image_rgb: matrix = [0.299 0.587 0.114; 0.596 -0.274 -0.322; 0.211 -0.523 0.312]; row = 1:length(image_rgb(:,1,1)); col = 1:length(image_rgb(1,:,1)); p = image_rgb(row,col,:); %Here I have the problem mage_yiq(row,col,:) = matrix*image_rgb(row,col,:); max_y = max (max(image_yiq(:,:,1))); max_i = max (max(image_yiq(:,:,2))); max_q = max (max(image_yiq(:,:,3))); %Renormalize the image again after the multipication % to [0,1]. image_yiq(:,:,1) = image_yiq(:,:,1)/max_y; image_yiq(:,:,2) = image_yiq(:,:,2)/max_i; image_yiq(:,:,3) = image_yiq(:,:,3)/max_q; I can't understand why the matrix multiplication fails. I want the code to be nice and not just to, multiply the matrix by hand...

    Read the article

  • How to Save data in txt file in MATLAB

    - by Jessy
    I have 3 txt files s1.txt, s2.txt, s3.txt.Each have the same format and number of data.I want to combine only the second column of each of the 3 files into one file. Before I combine the data, I sorted it according to the 1st column: UnSorted file: s1.txt s2.txt s3.txt 1 23 2 33 3 22 4 32 4 32 2 11 5 22 1 10 5 28 2 55 8 11 7 11 Sorted file: s1.txt s2.txt s3.txt 1 23 1 10 2 11 2 55 2 33 3 22 4 32 4 32 5 28 5 22 8 11 7 11 Here is the code I have so far: BaseFile ='s' n=3 fid=fopen('RT.txt','w'); for i=1:n %Open each file consecutively d(i)=fopen([BaseFile num2str(i)'.txt']); %read data from file A=textscan(d(i),'%f%f') a=A{1} b=A{2} ab=[a,b]; %sort the data according to the 1st column B=sortrows(ab,1); %delete the 1st column after being sorted B(:,1)=[] %write to a new file fprintf(fid,'%d\n',B'); %close (d(i)); end fclose(fid); How can I get the output in the new txt file in this format? 23 10 11 55 33 22 32 32 28 22 11 11 instead of this format? 23 55 32 22 10 33 32 11 11 22 28 11

    Read the article

  • Instantaneous frequency not plotting correctly in Matlab

    - by user2951069
    I'm trying to convert square wave data to instantaneous frequency and plot against time. It works correctly for one data set, but three others are plotting as shown in the image: http://i.imgur.com/iuL648o.png Time is linear, so it shouldn't be plotting like that. Anyone have any ideas as to what's going on? I'm using the following code: ddiff = diff(flow(:,1)); locations = find(ddiff(1:end-1,1)>0.1 & ddiff(2:end,1) <=0.1); for z = 2:length(locations) inst_freq(z-1) = 1/(time(locations(z))-time(locations(z-1))); freq_time(z-1) = time(locations(z)); end plot(freq_time,inst_freq)

    Read the article

  • Plotting a grouped 2 dimensional vector in MATLAB

    - by Hossein
    I am trying to make a plot of a 2-dimensional vector (2D Plot). But I don't want all the datapoints to have the same color on the plot. Each datapoint corresponds to a group. I want to have different colors for each group of datapoints. class=[1 3 2 5 2 5 1 3 3 4 2 2 2] says each datapoint belongs to which group X=[x1,y1;x2,y2;x3,y3;.....] the number of these datapoints are the same as the number of elements in the class vector. Now I want to plot these based on colors.

    Read the article

  • Extended maxima transform in Matlab

    - by garvin
    I use imtophat to apply a filter to an m x n array. I then find the local max using imextendedmax(). I get mostly 0's everywhere except for 1's in the general areas where I am expecting a local max. The weird thing is, though, that I don't get just one local max. Instead in these places I get MANY elements with 1's such as 00011100000 00111111000 00000110000 yet the values there are close but NOT equal so I would expect that there would be one that is higher than all of the rest. So I'm wondering a) if this is a bug and how I might fix it and b) how you would choose choose the element of these 1's with the highest value.

    Read the article

  • Special functions in Matlab

    - by favala
    I'm trying to get a picture like the following: http://upload.wikimedia.org/wikipedia/en/e/e6/Airy-3d.svg What am I doing wrong? [x,y]=meshgrid(-1:.1:1,-1:.1:1); surf(x,y,(2*besselj(1,2*pi*sqrt(x.^2+ y.^2)/sqrt(x.^2+ y.^2)).^2) Also... kind of a side note, but if I used ndgrid instead of meshgrid here my x's and y's would switch right?

    Read the article

  • Drawing a polygon around groups of datapoints in MATLAB

    - by Hossein
    Hi, I have a set of datapoints each of which belongs to a certain cluster(group).I need to draw a polygone around each of these clusters.Does anyone knows how to do it? PS: It doesn't matter if I use or not use the actual datapoints for drawing the polygon. I just need them to be wrapped in a polygon. Thanks

    Read the article

  • How to convert dates to numbers in Matlab

    - by user1297712
    I have some variables like these: a(1)=00:26:00 a(2)=744:32:00 a(3)=8040:33:00 I want to convert them to numbers, so I use the datenum command. The biggest number should be 8040:33:00, but look what happens. datenum(a([1 2 3])) ans = 1.0e+005 * 7.3487 7.3485 7.3486 But if I don´t calculate a(1): datenum(a([2 3],51)) ans = 1.0e+005 * 7.3490 7.3520 That´s the results that I want to get. I think that the problem is that a(2) and a(3) have more than 24hours but I haven´t found any way to solve this problem. Thanks.

    Read the article

  • Getting data into MATLAB from HTTPS

    - by yuk
    Anybody know if it's possible? I'm trying to get the data by using the following code url = 'https://cgwb.nci.nih.gov/cgi-bin/hgTracks'; params = {'org','Human','db','hg18','position','EGFR'}; urltxt = urlread(url,'get',params); but get the error ??? Error using ==> urlread at 111 Error downloading URL. Your network connection may be down or your proxy settings improperly configured. If I substitute https to http, it works, but I get "301 Moved Permanently" page with the above https-link. The link in browser works properly in both cases (redirecting http request). The site does not require any authentication. May be there are other ways than urlread?

    Read the article

  • Plotting a grouped 2 dimensional vevtor in MATLAB

    - by Hossein
    Hi, I am trying to make a plot of a 2-Dimensional vector(2D Plot).But I don't want all the datapoints to have the same color on the plot.Each datapoint corresponds to a group.I want to have different colors for each group of datapoints. class=[1 3 2 5 2 5 1 3 3 4 2 2 2] says each datapoint belongs to which group X=[x1,y1;x2,y2;x3,y3;.....] the number of thes datapoints are the same as the number of elements in th class vector. Now I want to plot these based on colors. Can someone help me? Thanks

    Read the article

  • find lowest neighbor matlab

    - by user1812719
    I am trying to write a function [offset,coffset]=findLowNhbr(map) that for each pixel in a map finds the eight neighbors to the pixel, and returns two matrices with both the row and column offsets to the lowest neighbor (uses the numbers -1, 0 and 1). Border pixels are given 0 offsets for both the row and column, since they do not have neighbors. Here is what I think the general plan for this function should be: For each point, find the eight nearest neighbors. If the neighbor is lower than the point, return -1 If the neighbor is at the same elevation as the point, return 0 If the neighbor is higher than the point, return +1 Store these offsets in two matrices. I am at a complete loss as to where to start, so any advice or questions are welcome!

    Read the article

  • Problem using find function in Matlab

    - by Peter Etchells
    Hi all, 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

  • Iterating through struct fieldnames in MATLAB.

    - by Noio
    My question is easily summarized as: "Why does the following not work?" teststruct = struct('a',3,'b',5,'c',9) fields = fieldnames(teststruct) for i=1:numel(fns) fns(i) teststruct.(fns(i)) end output: ans = 'a' ??? Argument to dynamic structure reference must evaluate to a valid field name. Especially since teststruct.('a') does work. And fns(i) prints out ans = 'a'. I can't get my head around it.

    Read the article

  • Plot overlaps in matlab

    - by ZaZu
    Hey there, I got a strange problem that the plot overlaps in the graph, but not in the image. I am sure I didnt leave hold on somewhere or else it will overlap in the image itself as well. Here is a sample : Any ideas ? Thanks

    Read the article

  • Problem with loop MATLAB

    - by Jessy
    no time scores 1 10 123 2 11 22 3 12 22 4 50 55 5 60 22 6 70 66 . . . . . . n n n Above a the content of my txt file (thousand of lines). 1st column - number of samples 2nd column - time (from beginning to end ->accumulated) 3rd column - scores I wanted to create a new file which will be the total of every three sample of the scores divided by the time difference of the same sample. e.g. (123+22+22)/ (12-10) = 167/2 = 83.5 (55+22+66)/(70-50) = 143/20 = 7.15 new txt file 83.5 7.15 . . . n so far I have this code: fid=fopen('data.txt') data = textscan(fid,'%*d %d %d') time = (data{1}) score= (data{2}) for sample=1:length(score) ..... // I'm stucked here .. end ....

    Read the article

  • MATLAB - Index exceeds matrix dimensions

    - by Jessy
    Hi I have problem with matrix.. I have many .txt files with different number of rows but have the same number of column (1 column) e.g. s1.txt = 1234 rows s2.txt = 1200 rows s2.txt = 1100 rows I wanted to combine the three files. Since its have different rows .. when I write it to a new file I got this error = Index exceeds matrix dimensions. How I can solved this problem? .

    Read the article

  • Matlab Error- fplot();

    - by udsha
    >> fplot(fh,[-2 4]) ??? Undefined function or variable "e". Error in ==> myfun at 3 Y(:,2) = e(:).^x; Error in ==> fplot at 102 x = xmin; y = feval(fun,x,args{4:end}); I tried to plot two function using this m file. function Y = myfun(x) Y(:,1) = 3*x; Y(:,2) = e(:).^x;

    Read the article

  • Graphing special functions in Matlab (2D Bessel)

    - by favala
    I'm trying to essentially get something like this where I can see clear ripples at the base but otherwise it's like a Gaussian: This is kind of unsatisfactory because the ripples aren't very noticeable, it has a very gritty quality that obscures the image a bit, and if you move the graph so that it's just in 2D (so it looks like a circle) I'm not even sure if it's quite like how it should be (the concentric circles seem to be more evenly spaced in the real thing). So, is there a better way to do this? a = 2*pi; [X Y] = meshgrid(-1:0.01:1,-1:0.01:1); R = sqrt(X.^2+Y.^2); f = (2*besselj(1,a*R(:))./R(:)).^2; mesh(X,Y,reshape(f,size(X))); axis vis3d;

    Read the article

  • MATLAB pdist function

    - by James
    Hi, I am using the pdist command to find the distance between x and y coordinates stored in a matrix. X = [100 100; 0 100; 100 0; 500 400; 300 600;]; D = pdist(X,'euclidean') Which returns a 15 element vector. : [0.734979755525412 3.40039811339820 2.93175207511321 1.83879677592575 2.40127440268306 2.75251513299386 2.21488402640753 1.10610649500317 1.81674017301699 0.903207751535635 1.99116952754924 1.05069952386082 1.24122819418333 1.08583377275532 1.38729428638035] Is there a way to associate these distances with the coordinates they were derived from, i.e. store them in a matrix with the general row form: [Length xcoordinate1 ycoordinate1 xcoordinate2 ycoordinate2] Where there is a row for each length found? Thanks in advance

    Read the article

  • matlab: simple matrix filtering - group size

    - by Art
    I have a huuuge matrix storing information about X and Y coordinates of multiple particle trajectories , which in simplified version looks like that: col 1- track number; col 2- frame number; col 2- coordinate X; col 3- coordinate Y for example: A = 1 1 5.14832 3.36128 1 2 5.02768 3.60944 1 3 4.85856 3.81616 1 4 5.17424 4.08384 2 1 2.02928 18.47536 2 2 2.064 18.5464 3 1 8.19648 5.31056 3 2 8.04848 5.33568 3 3 7.82016 5.29088 3 4 7.80464 5.31632 3 5 7.68256 5.4624 3 6 7.62592 5.572 Now I want to filter out trajectories shorter than lets say 2 and keep remaining stuff like (note renumbering of trajectories): B = 1 1 5.14832 3.36128 1 2 5.02768 3.60944 1 3 4.85856 3.81616 1 4 5.17424 4.08384 2 1 8.19648 5.31056 2 2 8.04848 5.33568 2 3 7.82016 5.29088 2 4 7.80464 5.31632 2 5 7.68256 5.4624 2 6 7.62592 5.572 How to do it efficiently? I can think about some ideas using for loop and vertcat, but its the slowest solution ever :/ Thanks!

    Read the article

  • matlab: putting a circled number onto a graph

    - by Jason S
    I want to put a circled number on a graph as a marker near (but not on) a point. Sounds easy, but I also want to be invariant of zoom/aspect ratio changes. Because of this invariant, I can't draw a circle as a line object (without redrawing it upon rescale); if I use a circle marker, I'd have to adjust its offset upon rescale. The simplest approach I can think of is to use the Unicode or Wingdings characters ① ② ③ etc. in a string for the text() function. But unicode doesn't seem to work right, and the following sample only works with ① and not for the other numbers (which yield rectangle boxes): works: clf; text(0.5,0.5,char(129),'FontName','WingDings') doesn't work (should be a circled 2): clf; text(0.5,0.5,char(130),'FontName','WingDings') What gives, and can anyone suggest a workaround?

    Read the article

  • MATLAB syntax of (:)

    - by user198729
    >> I=[2 1 3;3 2 4] I = 2 1 3 3 2 4 >> I(:) ans = 2 3 1 2 3 4 >> I(1:2) ans = 2 3 >> Why the first call I(:) returns a vector while the second I(1:2) doesn't which is essentially the same as I(:)?

    Read the article

  • 3x3 Average filter in matlab

    - by turingcomplete
    I've written code to smooth an image using a 3x3 averaging filter, however the output is strange, it is almost all black. Here's my code. function [filtered_img] = average_filter(noisy_img) [m,n] = size(noisy_img); filtered_img = zeros(m,n); for i = 1:m-2 for j = 1:n-2 sum = 0; for k = i:i+2 for l = j:j+2 sum = sum+noisy_img(k,l); end end filtered_img(i+1,j+1) = sum/9.0; end end end I call the function as follows: img=imread('img.bmp'); filtered = average_filter(img); imshow(uint8(filtered)); I can't see anything wrong in the code logic so far, I'd appreciate it if someone can spot the problem.

    Read the article

  • MATLAB help required function root

    - by programmeur
    Dear All, I have made an program, function bisection; x1=input('enter the first value=') x2=input('enter the second value=') %f3=[]; for x=1:20 %x=1; x3=(x1+x2)/2; while x3-x1 >= 0.001 f3(x)=x3^3 + x3^2 - 3*x3 - 3; f1(x)=x1^3 + x1^2 - 3*x1 - 3; if ((f3(x)*f1(x)) < 0) x2=x3; else x1=x3; end break end format long f3' disp('The root is found to be ='); x3 end . . . . . program calculate function of interval (x1, x2) given by user, my program compile and execute but little stupid repetition until for loop complete, i want to stop further printing loop when desired value is achieved with while condition is used.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >