matlab

Fitting 2D data in Matlab

How would you fit a 2d curve such as ln(x^2) + 3y to an mxn array? Update I mean I have mxn array and want fit it with a 2D curve. Sorry for confusion. ...

Creating nested cell arrays in Matlab?

I have two cell arrays one called info{} and the other is called data{} I am reading information in from a text file and am putting the lines into the info{} cell array. When the program finds a blank line I want to to start over with a new info{} cell array and keep inserting the lines until it find another blank line... global dat...

Undefined function or method 'cornermetric' for input arguments of type 'logical'

i m trying to find corners in an image. I m using matlab 7.6 version and facing this error. here is code k='coins1.png'; i=imread(k); im=im(1:150,1:120); c=cornermetric(im); ...

Can I run matlab on Windows with UI, just that the code runs on remote server?

Hey, I am using my laptop to run MATLAB and it's very convenient but SLOW. We have strong servers that run MATLAB but it's more convenient for me to run the application with UI on my laptop (as opposed to say running Matlab through command line). Is it possible to run matlab on Windows, locally, with UI, just that the code runs on a rem...

MATLAB create a new column

http://stackoverflow.com/questions/3071558/how-can-i-merge-this-data-in-matlab my question is related to the above link. With the code below (thanks gnovice), it will create a new file with 3 column (overwrite column time). Instead of overwrite column time I want to add the modified time as a new column..which makes the new file =4 colu...

Getting names of Access database tables with Matlab

Hi! I'm trying to get a listing of all tables in an Access database using Matlab. I'm so far using an actxobject and can successfull run queries against the database, but all methods I've read here have failed. I consistently get the error message 'No read permission on MSysObjects'. The query runs fine within the Access-program, but ...

How can I perform this cumulative sum in MATLAB?

I want to calculate a cumulative sum of the values in column 2 of dat.txt below for each string of ones in column 1. The desired output is shown as dat2.txt: dat.txt dat2.txt 1 20 1 20 20 % 20 + 0 1 22 1 22 42 % 20 + 22 1 20 1 20 62 % 42 + 20 0 11 0 11 11 0 12 0 12 12 1 99 1 99 99 % 99 + 0 1 20 ...

How can I append values to a 2D array?

I am new to MATLAB, and I can't fathom this from the documentation. function GotData(sender, args) interval = args.DataBlock.TimeIntervalInMicroseconds; doubles = args.DataBlock.AsDoubleArray(); x = 0; complexCount = length(double(doubles))/2; DATA = zeros(complexCount); for index = 1:(complexCount-1) rea...

Import a binary image from matlab to a "C" program

I have a binary image in Matlab, and I need the binary array(0 and 1) in a C program, How can I import it? I can save the binary image in Matlab as ".mat" but I don't know how to read the mat file in C. Also I thought maybe I can save the binary image in Matlab as ".bin" which is readable in "C" but again I don't know how to save an ima...

Is there a Matlab tool similar to Python's Doctest?

Hi, In my Python development, doctest has really helped both to make writing unit tests less annoying, and integrate usage examples with documentation. I was wondering, is there anything like this available in the Matlab world? It doesn't have to literally use code comments as a test, but if it had those two desirable qualities, t...

Reading strings into Matlab from excel?

I would like to read strings into Matlab from an excel file ID = xlsread('data.xlsx',1, 'D2:D4') the cells in range D2:D4 have strings in them. When I try to import the strings into Matlab all I get is an empty list? what can I do to fix this? ...

How do I write/export a few matrices to an XLS file?

I have a lot of matrix variables. Some have more than 200 rows. How can I export them to an XLS or DAT file with their names? I tried the following: d = {'X', 'Y'; X Y}; xlswrite('tempdata1.xls', d, 'Sheet1', 'A1'); What I got in the XLS file was only the strings 'X' and 'Y' but without the values of X and Y. X and Y should be vectors...

Writing strings into excel using Matlab?

I am writing a cell array of string into Excel from Matlab. I have a cell array data{} that I am trying to write into Matlab. It should writting three large lengths of strings to excel since the strcmp passes 3 times. Currently it is only writing the last set of strings into excel. data = { {1x25} {1x35} {1x20} } looks like this. Also I ...

Pulling a subset of a matrix in MATLAB

I want to cluster an array, this array contain some angle I want to calculate the difference between of these degree and select one group between this array, this group should have maximum number and the difference between the member of that should not be larger than specific number. for example if specific number is 30 and array is ...

Beginning Matlab question (matrix of zeros)

Why create a matrix of 0's in Matlab? For example, A=zeros(5,5); for i = 1:5 A(i)=exp(i); end ...

Best practices for MATLAB message IDs?

When creation a MATLAB exception (MException object) or printing a warning or error message, MATLAB lets you supply a message ID that defines the except you're throwing. The message ID is in the format: component:mnemonic For example, MATLAB's own undefined variable message ID is: MATLAB:dispatcher:nameConflict So when you use exc...

What is the ' (single quote) operator in MATLAB?

[code that does not change the question snipped] M = M'; What is M = M';? ...

Matlab - Determine signal frequency

I am trying to determine the frequency of a signal given as a vector in Matlab. Any idea how to do it ? ...

processing files in 64 bit machine but developing in 32 bit machine

i am going to read a TDMS file in matlab using Mexfunction in C language in a 64 bit windows machine, but i will develop the app in 32 bit windows machine. i know in there is a difference between 32 bit machine and 64 bits with the size of variables. i used a lot of fread(.. sizeof(type)..). is it going to be a problem when it is running...

Matlab: create new matrix from existing matrix according to specifications

Assume we have the following data: H_T = [36 66 21 65 52 67 73; 31 23 19 33 36 39 42] P = [40 38 39 40 35 32 37] Using MATLAB 7.0, I want to create new three matrices that have the following properties: The matrix H (the first part in matrix H_T) will be divided to 3 intervals: Matrix 1: the 1st interval contains the H values bet...