Search Results

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

Page 12/43 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Creating matrix of maximum values indices in MATLAB

    - by Gacek
    Using MATLAB, I have an array of values of size 8 rows x N columns. I need to create a matrix of the same size, that counts maximum values in each column and puts 1 in the cell that contains maximum value, and 0 elsewhere. A little example. Lets assume we have an array of values D: D = 0.0088358 0.0040346 0.40276 0.0053221 0.017503 0.011966 0.015095 0.017383 0.14337 0.38608 0.16509 0.15763 0.27546 0.25433 0.2764 0.28442 0.01629 0.0060465 0.0082339 0.0099775 0.034521 0.01196 0.016289 0.021012 0.12632 0.13339 0.11113 0.10288 0.3777 0.19219 0.005005 0.40137 Then, the output matrix for such matrix D would be: 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 Is there a way to do it without catching vector of indices from max function and then putting ones in the right place using for loop?

    Read the article

  • MATLAB - Delete elements of binary files without loading entire file

    - by Doresoom
    This may be a stupid question, but Google and MATLAB documentation have failed me. I have a rather large binary file (10 GB) that I need to open and delete the last forty million bytes or so. Is there a way to do this without reading the entire file to memory in chunks and printing it out to a new file? It took 6 hours to generate the file, so I'm cringing at the thought of re-reading the whole thing. EDIT: The file is 14,440,000,000 bytes in size. I need to chop it to 14,400,000,000.

    Read the article

  • MATLAB: draw centroids

    - by Myx
    Hello - my main question is given a feature centroid, how can I draw it in MATLAB? In more detail, I have an NxNx3 image (an rgb image) of which I take 4x4 blocks and compute a 6-dimensional feature vector for each block. I store these feature vectors in an Mx6 matrix on which I run kmeans function and obtain the centroids in a kx6 matrix, where k is the number of clusters and 6 is the number of features for each block. How can I draw these center clusters in my image in order to visualize if the algorithm is performing the way I wish it to perform? Or if anyone has any other way/suggestions on how I can visualize the centroids on my image, I'd greatly appreciate it. Thank you.

    Read the article

  • Changeing scaling of Matlab Figure

    - by Phil
    Hi, I have a figure that displays 20.000 points on the x-axis. So it labels the x-axis from 0 .. 20.000. However, now I would like to scale it form 0 to 50. But when I try to do this in the plot window it just shows me the first 50 points, instead of changeing the scale. Is there any straightforward way to do that in Matlab? Many thanks for your help!

    Read the article

  • Default Arguments in Matlab

    - by Scott
    Hello. Is it possible to have default arguments in Matlab? For instance, here: function wave(a,b,n,k,T,f,flag,fTrue=inline('0')) I would like to have the true solution be an optional argument to the wave function. If it is possible, can anyone demonstrate the proper way to do this? Currently, I am trying what I posted above and I get: ??? Error: File: wave.m Line: 1 Column: 37 The expression to the left of the equals sign is not a valid target for an assignment. Thanks!

    Read the article

  • matlab constant anonymous function returns only one value instead of an array

    - by Filo
    I've been searching the net for a couple of mornings and found nothing, hope you can help. I have an anonymous function like this f = @(x,y) [sin(2*pi*x).*cos(2*pi*y), cos(2*pi*x).*sin(2*pi*y)]; that needs to be evaluated on an array of points, something like x = 0:0.1:1; y = 0:0.1:1; w = f(x',y'); Now, in the above example everything works fine, the result w is a 11x2 matrix with in each row the correct value f(x(i), y(i)). The problem comes when I change my function to have constant values: f = @(x,y) [0, 1]; Now, even with array inputs like before, I only get out a 1x2 array like w = [0,1]; while of course I want to have the same structure as before, i.e. a 11x2 matrix. I have no idea why Matlab is doing this...

    Read the article

  • Find location of current m-file in Matlab

    - by Jordi
    I'm working on my Matlab code in a number of different locations and it would really help if I could make the code aware of its location on the computer. I think there is a function that gives me exactly this information, but I can't remember what it is called or find it on Google. The idea is that I have a function myFunc that needs a file in its own directory, which can be in different locations on different computers. So in myFunc I want to do something like this: dir = theFunctionImLookingFor; system(fullfile(dir, 'someApp.exe')); (it could also be that the function I'm looking for doesn't return the directory, but the directory + m-file name, but that makes little difference to me) Thanks for any help!

    Read the article

  • How to deal with name/value pairs of function arguments in MATLAB

    - by Richie Cotton
    I have a function that takes optional arguments as name/value pairs. function example(varargin) % Lots of set up stuff vargs = varargin; nargs = length(vargs); names = vargs(1:2:nargs); values = vargs(2:2:nargs); validnames = {'foo', 'bar', 'baz'}; for name = names validatestring(name{:}, validnames); end % Do something ... foo = strmatch('foo', names); disp(values(foo)) end example('foo', 1:10, 'bar', 'qwerty') It seems that there is a lot of effort involved in extracting the appropriate values (and it still isn't particularly robust again badly specified inputs). Is there a better way of handling these name/value pairs? Are there any helper functions that come with MATLAB to assist?

    Read the article

  • Matlab Question - Principal Component Analysis

    - by Jack
    I have a set of 100 observations where each observation has 45 characteristics. And each one of those observations have a label attached which I want to predict based on those 45 characteristics. So it's an input matrix with the dimension 45 x 100 and a target matrix with the dimension 1 x 100. The thing is that I want to know how many of those 45 characteristics are relevant in my set of data, basically the principal component analysis, and I understand that I can do this with Matlab function processpca. Could you please tell me how can I do this? Suppose that the input matrix is x with 45 rows and 100 columns and y is a vector with 100 elements.

    Read the article

  • Matlab time stamps reading

    - by Paul
    Any easy way to read all the columns in Matlab? my format is date time y1 y2 y3 y4 ......................... 4/27/2010 00:3:09 34 45 45 56 ................ so on currently i am reading these with the code [c,pathc]=uigetfile({'*.txt'},'Select the data','C:\Data'); file=[pathc c]; data= dlmread(file, ',', 1,3); so needless to say i am skipping the time stamps. Was wondering if there is aeasy way to read the time stamps and plot my other colums agianst the time in hours. my files are 43200 X 30 and some are 86400 X 90 Related question : is the format same for .csv and .xls files , i mean except ofcourse xlsread

    Read the article

  • Sorting in Matlab

    - by smichak
    Hi, I would like to sort elements in a comma-separated list. The elements in the list are structs and I would like the list to be sorted according to one of the fields in the struct. For example, given the following code: L = {struct('obs', [1 2 3 4], 'n', 4), struct('obs', [6 7 5 3], 'n', 2)}; I would want to have a way to sort L by the field 'n'. Matlab's sort function only works on matrices or arrays and on lists of strings (not even lists of numbers). Any ideas on how that may be achieved? Thanks, Micha

    Read the article

  • Get dimensions for dataset matlab, Size Function

    - by Tim
    Hello I have been trying to display the dimensions of a dataset, below is the following matlab code that i used...but it gives me the wrong output....i'e number of rows and columns values are wrong....any help regarding this issue would be highly appreciated [file_input,pathname] = uigetfile( ... {'*.txt', 'Text (*.txt)'; ... '*.xls', 'Excel (*.xls)'; ... '*.*', 'All Files (*.*)'}, ... 'Select files'); [pathstr, name, ext, versn] = fileparts(file_input) r = size(name,1); c = size(name,2); disp(r) disp(c)

    Read the article

  • troubles with integration on matlab

    - by user648666
    I'd like some help please I really need to solve this problem. Well before anything thank you for your time... My problem: I have a matrix (826x826 double) and I want to integrate this matrix with respect to a vector of (826x1 double) I don't have the functions of any of this. Is there a command or an algorithm to take the integral of a matrix with respect to a vector? Please I really need help, I'm such a newbie at matlab. Sincerely. George

    Read the article

  • FFT in MATLAB: wrong 0Hz frequency

    - by roujhan
    Hello I want to use fft in MATLAB to analize some exprimental data saved as an excell file. my code: A=xlsread('Book.xls'); G=A'; x=G(2, : ); N=length(x); F=[-N/2:N/2-1]/N; X = abs(fft(x-mean(x),N)) X = fftshift(X); plot(F,X) But it plots a graph with a large 0Hz wrong component, my true frequency is about 395Hz and it is not shown in the plotted graph. Please tell me what is wrong. Any help would be appreciated.

    Read the article

  • Reading Matrices in MATLAB and assigning coordinates to the entries

    - by Michael Schofield
    Hi, I'm a bit new to MATLAB. Basically, I have a 25x25 Matrix, complete with various random entries ranging from 0 to 3. I need to write a program that reads this matrix, and assigns x-y coordinates to the entries, so that when I ask for an input of a particular x-y coordinate which has, say an entry of 3, then it will result in an error. I'm a bit overwhelmed - but I understand the general concept of what I'm supposed to be finding. I'm wondering if I should use a plot instead to help me.

    Read the article

  • Background subtracting in MATLAB

    - by eiphyomin
    I'm looking to do background subtracting on an image. I'm new to MATLAB and new to image processing/analysis, so sorry if any of this sounds stupid. 1) Other than imsubtract() are there other ways to do background subtracting (besides comparing one image to another)? 2) In the Math Works explanation for imsubtract() why do they make their structuring element a disk? This seems rather difficult so far because every time I try something, I end up not only subtracting the noisy background but also losing the parts of the image I want to look at!

    Read the article

  • read text files containing binary data as a single matrix in matlab

    - by user1716595
    I have a text file which contains binary data in the following manner: 00000000000000000000000000000000001011111111111111111111111111111111111111111111111111111111110000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111000111100000000000000000000000000000000 00000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111000111110000000000000000000000000000000 00000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111110000000000000000000000000000000 00000000000000000000000000000000000000000000111111111111111111111111111111111111110000000011100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111100111110000000000000000000000000000000 00000000000000000000000000000000000111111111111111111111111111111111111111111111111111110111110000000000000000000000000000000 00000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000001111111111111111111111111111111111111111111111000011100000000000000000000000000000000 00000000000000000000000000000000000000001111111111111111111111111111111111111111111111000011100000000000000000000000000000000 00000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111000000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111110000011100000000000000000000000000000000 00000000000000000000000000000000000000000000011111111111111111111111111111111111100000000011100000000000000000000000000000000 00000000000000000000000000000000000000111111111111111111111111111111111111111111111111110111100000000000000000000000000000000 Plz note that each 1 or 0 is independent i.e the values are not decimal.I need to find the column wise sum of the file.There are 125 columns in all (here it is jumping onto the next line) and there are 840946 rows. I have tried textread,fscanf and a few other matlab commands but the result is that they all read each row in decimal format and create a 840946*1 array.I want to create a 840946*125 array to compute a column wise sum. Kindly help, Thanks!

    Read the article

  • MATLAB: Designing a "Warm Start"

    - by squall14414
    I'm currently coding a function in MATLAB that has two steps: It processes some data It does some calculations on the processed data I'm using the function to run a series of experiments, where I tweak the way calculations occur in step 2). Seeing how I'm working with a large dataset and the data processing step takes a while each time, however, I'm wondering whether there is anyway to code in a "warm start" in the function. That is to say, is there anyway to save all the progress that I've done after step 1) so that if I run the function a second or third time, it can skip step 1) and go right to step 2)?

    Read the article

  • MatLab plot part of surface

    - by Kristian
    Say I have the following script: u = -5:.2:5; [X,Y] = meshgrid(u, u); Z = cos(X).*cos(Y).*exp(-sqrt(X.^2 + Y.^2)/4); surf(X,Y,Z); Is there anyway that I can make MatLab plot only parts of the surface? Say, for instance, I just want to plot a single point, or a single grid, what can I do? I thought perhaps to plot a single point I could use: surf(X(1,1), Y(1,1), Z(1,1)) But then I get the error message: ??? Error using ==> surf at 78 Data dimensions must agree. I would really appreciate some input/help here. Thanks in advance :)

    Read the article

  • Finding whether a value is equal to the value of any array element in MATLAB

    - by James
    Hi, Can anyone tell me if there is a way (in MATLAB) to check whether a certain value is equal to any of the values stored within another array? The way I intend to use it is to check whether an element index in one matrix is equal to the values stored in another array (where the stored values are the indexes of the elements which meet a certain criteria). So, if the indices of the elements which meet the criteria are stored in the matrix below: criteriacheck = [3 5 6 8 20]; Going through the main array (called array) & checking if the index matches: for i = 1:numel(array) if i == 'Any value stored in criteriacheck' ... "Do this" end Does anyone have an idea of how I might go about this? Thanks in advance

    Read the article

  • DAQ Triggers in Matlab

    - by RidePlanet
    I'm writing a program that detects the speed of a object by hall effect sensors that are run into MATLAB through a DAQ (MCC USB-1408FS) The problem that has arisen is that I'm using a non-stop scan technique to detect the state of one of 3 sensors. Unfortunately this means that unless the object is rotating past each sensor at the exact rate the program runs, I will see an instantaneous speed (done by comparing the time between two sensors) of zero. I need the sensors to signal the program to count when they are hit, instead of constantly scanning for the signal. How can this be done?

    Read the article

  • summing up excel files in matlab

    - by AP
    Is there a easy good way to sum up various excel files in matlab? what i really want is similar to dos command type file*.xls sumfile.xls I have from 10-100 excel files with similar file name formats excet the date XXXXX_2010_03_03.xls, XXXXX_2010_03_03.xls and so on..... Is there a command to copy the files one after other. All files are of diff length so i cannot know the position of the rows after each file. I would like to have them copied in same sheet of excel. Thanks

    Read the article

  • Skip reading strings in matlab

    - by Paul
    Is there is easy command in matlab which prevents program from crashing when it reads characters? I use xlsread to read a (20 400) matrix data , the first row and column get disregarded as they have headers, so that: data = xlsread ( ' C:\file.xls') results in data with a size of (19 399). I have a problem, some cells have missing data and it's written ' missing' and on some data sets i have headers reappear in middle. Is there a way to skip these characters without the program crashing and me having to open the file in excel and deleting those fields? Thanks

    Read the article

  • MATLAB intersection of 2 surfaces

    - by caglarozdag
    Hi everyone, I consider myself a beginner in MATLAB so bear with me if the answer to my question is an obvious one. Phi=0:pi/100:2*pi; Theta=0:pi/100:2*pi; [PHI,THETA]=meshgrid(Phi,Theta); R=(1 + cos(PHI).*cos(PHI)).*(1 + cos(THETA).*cos(THETA)); [X,Y,Z]=sph2cart(THETA,PHI,R); surf(X,Y,Z); %display hold on; x1=-4:.1:4; [X1,Y1] = meshgrid(x1); a=1.8; b=0; c=3; d=0; Z1=(d- a * X1 - b * Y1)/c; shading flat; surf(X1,Y1,Z1); I have written this code which plots a 3d cartesian plot of a plane intersecting a peanut shaped object at an angle. I need to get the intersection of these on 2D (going to be the outline of a peanut, but a bit skewed since the intersection happens at an angle), but don't know how. Thanks

    Read the article

  • Problem in matlab with too many outputs

    - by Ben Fossen
    I am writing a Matlab program for simpson's rule I keep getting an error about to many outputs when the program gets to left_simpson = Simpson(a,c,(e1)/2,level, level_max); What is wrong with settinf left_simpson to Simpson(a,c,(e1)/2,level, level_max);? function Simpson(a,b,e1,level, level_max) level = level + 1; h = b - a; c = (a+b)/2; one_simpson = h*(f(a) + 4*f(c) + f(b))/6; d = (a+c)/2; e = (c+b)/2; two_simpson = h*(f(a) + 4*f(d) + 2*f(c) + 4*f(e))/2; if level >= level_max disp('h') simpson_result = two_simpson; disp('maximum levels reached') disp(simpson_result); if abs(two_simpson - one_simpson) < 15*e1 simpson_result = two_simpson + (two_simpson - one_simpson)/15; else left_simpson = Simpson(a,c,(e1)/2,level, level_max); right_simpson = Simpson(c,b,(e1)/2,level, level_max); simpson_result = left_simpson + right_simpson; end end

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >