matlab

MATLAB: Drawing a line over a black and white image

What is the best way to draw a line over a black and white (binary) image in MATLAB, provided the start and end coordinates are known? Please note, I am not trying to add an annotation line, I would like the line to become part of the image. ...

How do I get rid of NaNs in MATLAB?

I have files which have many empty cells which appear as NaNs when I use cell2mat but the problem is when I need to get the average values I cannot work with this as it shows error with NaN. In excel it overlooks, how do i do the same in MATLAB? # Addition to above question: It seems simple. I am writing a file using xlswrite xlswrit...

ieee 802.15.4 oqpsk with half-sine pulse shaping VS msk difference?

hi is there any difference between half-sine pulse shaping oqpsk used in IEEE 802.15.4 and MSK implemented here? ...

Can I distribute my MATLAB program as open source?

I know, the general answer will be yes, but here is my situation. I got a plotting function from one MATLAB's toolbox and modified its m-file to draw what I need. Eventually this function became a part of program I would like to distribute as an open source (or under other license). Can I do this? Well, may be it was not wise to create ...

Loopless function calls on vector/matrix members in Matlab/Octave

I came into matrix world from loop world (C, etc) I would like to call a function on each individual member of a vector/matrix, and return the resulting vector/matrix. This is how I currently do it: function retval = gauss(v, a, b, c) for i = 1:length(v) retval(i) = a*(e^(-(v(i)-b)*(v(i)-b)/(2*c*c))); endfor endfunction Exam...

How do I declare a symbolic matrix in Octave?

In MatLab, you can declare symbols pretty easily: syms a,b mat = [a,b] I'm getting an error, however, when I try to replicate this in Octave. This is the code I'm using: > symbols > a = sym("a") a = a > b = sym("b") b = b > mat = [a,b] error: octave_base_value::resize (): wrong type argument `ex' error: octave_base_value::resize ()...

summing up excel files in matlab

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

MATLAB pdist function

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

Unpacking varargin to individual variables

I'm writing a wrapper to a function that takes varargin as its inputs. I want to preserve the function signature in the wrapper, but nesting varargin causes all the variable to be lumped together. function inner(varargin) %#ok<VANUS> % An existing function disp(nargin) end function outer(varargin) % My wrapper inner(varargin); end ou...

MySQL and Matlab

I want to interact with a MySQL database from Matlab. I found a mysql "library" for matlab here and the same on mathworks. I followed the instructions to compile the library and the compilation seems to be successful. I get a mex32 file at the end. Only, the instructions on the first page refer to a Dll that I need to use (I guess that ...

matlab write image into eps file

In MATLAB, how do you write a matrix into an image of eps format? It seems imwrite does not support eps? convert is not working on the Linux server I am using $ convert exploss_stumps.jpg exploss_stumps.eps convert: missing an image filename `exploss_stumps.eps' @ convert.c/ConvertImageCommand/2838 Any idea why? I tried gnovi...

Matlab - building an array while looping

Hello, I have a for loop that loops over one array... for i=1:length(myArray) In this loop, I want to do check on the value of myArray and add it to another array myArray2 if it meets certain conditions. I looked through the Matlab docs, but couldn't find anything on creating arrays without declaring all their values on initialization...

Matlab - plot multiple data sets on a scatter plot

Hey all, I have 2 sets of data (Ax, Ay; Bx, By) - I'd like to plot both of these data sets on a scatter plot with different colors, but can't seem to get it to work because it seems scatter() does not work like plot(). Is it possible to do this? I've tried... scatter(Ax, Ay, 'g', Bx, By, 'b') And scatter(Ax, Ay, 'g') scatter(Bx, By,...

Why does file have to be saved prior to running ?

In MATLAB, why does the file have to be saved prior to running ? I often try quick snippets of code, which I could also easily run also on the Command Window line by line. So, why when I run them through the editor, I have to save them first ? Can this behaviour be changed, maybe ? ...

save plot into image file in matlab: difference between saveas and print

Hi I wonder when saving plot into image file in matlab, what is the difference between saveas and print? In what cases both can be used and in what cases only one can be used? Thanks and regards! ...

plot multi graphs with 2 y axis in 1 graph

Hello, Currently I have a a text file with data at the first row is formatted as follow: time;wave height 1;wave height 2;....... I have column until wave height 19 and rows total 4000 rows. Data in the first column is time in second. From 2nd column onwards, it is wave height elevation which is in meter. I would like to plot the foll...

Texture mapping in MATLAB

I have points in 3D space and their corresponding 2D image points. How can I make a mesh out of the 3D points, then texture the triangle faces formed by the mesh? Update See answer ...

Invoking ADO.NET from MATLAB

It's possible to call .NET from MATLAB, so I thought I would try to use ADO.NET to connect to a database. I seem to have hit a blocking problem - anytime you try and create a Command object, it throws an error. You can try this yourself: >> NET.addAssembly('System.Data'); >> sqlconn = System.Data.SqlClient.SqlConnection(); >> sqlconn....

Automatic test data generation using genetic algorithm in MATLAB

I am doing my project in software testing. Genetic algorithm is the technique I want to use to generate automatic test data\test cases in MATLAB. Please help me in doing my project successfully. ...

MATLAB: dealing with java.lang.String

I seem to be stuck in Kafka-land, with a java.lang.String that I can't seem to use in MATLAB functions: K>> name name = Jason K>> sprintf('%s', name) ??? Error using ==> sprintf Function is not defined for 'java.lang.String' inputs. K>> ['my name is ' name] ??? Error using ==> horzcat The following error occurred converting from cha...