matlab

comparing numbers in matlab

I am trying to classify some data based on euclidean distances in matlab the only problem is that matlab is giving me numbers that look like these as distances 0 + 4.9713i 0 + 7.8858i num1<num2 num2<num1 both return 0. how is this possible? ...

Strcmp for cell arrays of unequal length in MATLAB

Is there an easy way to find a smaller cell array of strings within a larger one? I've got two lists, one with unique elements, and one with repeating elements. I want to find whole occurrences of the specific pattern of the smaller array within the larger. I'm aware that strcmp will compare two cell arrays, but only if they're equal in ...

Cleaning up blurry images using Matlab

I want to take an image of blurry cylindrical objects and get rid of the blur, basically sharpen the image. How do I do that in Matlab? ...

Matlab cannot start, error: "Cannot locate com/mathworks/jmi/OpaqueJavaInterface class"

Hey dear all, I try to start Matlab(version 7.6.0 R2008) and received the error: "Cannot locate com/mathworks/jmi/OpaqueJavaInterface". I did some googling, and it seems this is related with the jre Matlab is using. Here is what I have done: I checked my java project and found that my source lookup path is: "c:\Program Files\Java\jre6"...

3D scatter plots in Matlab

Hi, I'm fairly new to Matlab and would appreciate some help. I'm trying to graph a scatter plot of a function. Later on I'm going to fit other functions to this data and plot that on the same figure. But what I have so far plots the markers all in one plane, which isn't what I want. The function is 2D, the graph should be 3D. How do I ge...

Matlab find does not work with high dimensional array?

say A = rand(2,2,2); [a,b,c] = find(A == A(1,2,2)) I got a=1 b=4 c=1 what? ...

Loading saved objects from disk is slow in Matlab

I have created a monster, or at least a lot of MATLAB handle classes that point to each other. For instance, an experiment (handle) is a set of tracks (handles) which contain runs (handle) and reorientations (handle). Then the tracks point pack to the experiment that contains them, the runs and reorientations point back to the track th...

Python binary file reading problem

I'm trying to read a binary file (which represents a matrix in Matlab) in Python. But I am having trouble reading the file and converting the bytes to the correct values. The binary file consists of a sequence of 4-byte numbers. The first two numbers are the number of rows and columns respectively. My friend gave me a Matlab function he...

Working with meshgrid in MATLAB

How would you replace the following by meshgrid? N=.33; P=.45; for i =1:10 for j=1:20 x0=i+N; y0=j+P; f(i,j)=exp(x0+y0); end end ...

socket programming in MATLAB ?

i have two machines running MATLAB and i need to exchange information(numbers,images) between them,is there a way in MATLAB i can do it? ...

How to call Matlab form C++ code?

I am trying to call Matlab functions form C++ code. With Matlab it comes an example of such code at /extern/examples/eng_mat/engdemo.cpp, however I found no way to build that source code. Here is the makefile I use: CFLAGS = -Wall -O3 INCLUDES = -I/opt/Matlab-2009a/extern/include LIBRARIES = -Wl,-R/opt/Matlab-2009a/bin/glnx86 -L/opt...

Automated build for MATLAB

Has anyone had success setting up automated builds for MATLAB code? We are manually compiling our MATLAB code into EXE's and distributing them to our servers. If anyone has found a good way to automate this, I'd love to hear it. ...

Picking a front-end/interpreter for a scientific code.

The simulation tool I have developed over the past couple of years, is written in C++ and currently has a tcl interpreted front-end. It was written such that it can be run either in an interactive shell, or by passing an input file. Either way, the input file is written in tcl (with many additional simulation-specific commands I have a...

Matlab delete repeating row

Possible Duplicate: How can I remove duplicates in an array but keep the same order? How I can delete duplicate row without sorting it? data.txt newData.txt 1 1 5 5 3 3 3 8 8 8 I have tried to use the function UNIQUE but it sorted the data in ascending order. I don't want it to be...

Line plots in Matlab

How do you do a line plot of a matrix such as A=rand(5) without using surf? ...

How do I calculate result for every value in a matrix in MATLAB

Keeping simple, take a matrix of ones i.e. U_iso = ones(72,37) and some parameters ThDeg = 0:5:180; dtheta = 5*pi/180; dphi = 5*pi/180; Th = ThDeg*pi/180; Now the code is omega_iso = 0; for i = 1:72 for j=1:37 omega_iso = omega_iso + U_iso(i,j)*sin(Th(j))*dphi*dtheta; end end and D_iso = (4 * pi)/omega_iso ...

matlab shared c++ libraries and OpenCL

Hi, I have a project that requires lots of image processing and wanted to add GPU support to speed things up. I was wondering if i compiled my matlab into c++ shared library and called it from within OpenCL program, does that mean that the matlab code is going to be run on GPU? ...

Matlab Matrix simple work

I have a very simple problem. Suppose we have the following code to calculate directivity of isotropic antenna. ThDeg = 0:5:180; dtheta = 5*pi/180; dphi = 5*pi/180; Th = ThDeg*pi/180; % the above are the angles at which the following matrix is acquired in practical case. In this case we take a matrix of all ones. U_iso = ones(72, 3...

How to convert Matlab variables to .dat (text) file with headers

EDITED QUESTION: I have 2500 rows x 100 columns seismic data in variable named avg_seismic_data_models. I also have 2500 rows x 100 columns variable 'X' and similar size matrix variable 'Y', both containing the co-ordinates. I want to save the values of this variable in a text (.dat) file which must have 302 header lines in the followi...

WindowButtonUpFcn issue: Why won't it release?

I'm trying to implement a line drawn in an axes, that when clicked on will follow the mouse so long as the button is down, and when the button is released the line will stop following. In short, reposition a line on a graph to a new position based on click and drag. I've been able to get up the point of having the line follow the mouse...