matlab

MATLAB settings - stop if errors

I found the "always stop on error (dbstop if error)" to be very useful when I debug MATLAB code. However, closing matlab also resets it to "Never stop if error" How can I make this setting persist? ...

Problems with Matlab javabuilder and memory

I'm experiencing some issues regarding my javabuilder-compiled matlab-code. My application is basically split up like this: GUI: Java Calculations: Matlab The main problem is that when compiling my matlab-code with the javabuilder in Matlab (R17, 2007a), I have less memory available than I have when I compile the same code to an exe-...

Is there a foreach in MATLAB? If so, how does it behave if the underlying data changes?

Is there a foreach structure in MATLAB? If so, what happens if the underlying data changes (i.e. if objects are added to the set)? ...

Binning in matlab

I have been unable to find a function in matlab or octave to do what I want. I have a matrix m of two columns (x and y values). I know that I can extract the column by doing m(:,1) or m(:,2). I want to split it into smaller matricies of [potentially] equal size and and plot the mean of these matricies. In other words, I want to put th...

Function names and parameters in matlab variables

In my matlab m-file I am using some logic (string concat) to build variables like this: c = 'CalcPrediction(1,10)' That means I have a string that is a function and some parameters. How can I do that function call? Trying run(c) results in: >> run(c) ??? Error using ==> run at 71 CalcPrediction(1,10) not found. Note: run(c) works ...

MATLAB Java referencing problem

I have a MATLAB class which contains a reference to a java object classdef MyClass properties j = myJavaClass end methods ... end end and after I use it (using clear, scope exit or explicitly setting myClass = 0; ) the java object is still alive - even after calling Runtime.gc. I see in the dump that the object is still i...

Better (non-linear) binning

The last question I asked concerned how to bin data by x co-ordinate. The solution was simple and elegant, and I'm ashamed I didn't see it. This question may be harder (or I may just be blind). I started out with about 140000 data points and split them into 70 groups equally spaced along the x axis I then took the average position (x...

How to draw a SURF graph without black edges in Matlab?

The black lines are awfull, how I get rid of them? I want only the colored surfaces. ...

How to create a new figure in Matlab?

Usually when I plot in Matlab it always draws on the same figure. How to make it draw in a new figure? I know it is pretty elementary, but I'm not finding it on Google. ...

How to draw (semi-)logarithmic 3d plots? (Matlab)

I know semilogx and semilogy for 2D plots. There is any equivalent for SURF and MESH? ...

How to get a beautiful color scale on (semi-)logarithmic 3d plots on Matlab?

After having this question answered through a link to an external site, I realized that I solved a problem, just to get another one: On a logarithm scale the C=Z parameter of MESH and SURF functions don't work very well. All you get is a blue graph, without the usual color gradient, that you get by passing 3 parameters. How to revert th...

Help me understand FFT function (Matlab)

1) Besides the negative frequencies, which is the minimum frequency provided by the FFT function? Is it zero? 2) If it is zero how do we plot zero on a logarithmic scale? 3) The result is always symmetrical? Or it just appears to be symmetrical? 4) If I use abs(fft(y)) to compare 2 signals, may I lose some accuracy? ...

Interoperating between Matlab and C#

After peeking around the internet it looks like it is possible to interop between C# and Matlab. I am wondering if anyone has had success with it and what they did to do so. If possible somehow pulling it off without the use of COM. Thanks for your time. ...

Storing MATLAB structs in Java objects

I'm using Java HashMap in MATLAB h = java.util.HashMap; And while strings, arrays and matrices works seemlessly with it h.put(5, 'test'); h.put(7, magic(4)); Structs do not h=java.util.HashMap; st.val = 7; h.put(7, st); ??? No method 'put' with matching signature found for class 'java.util.HashMap'. What would be the easiest...

What is MATLAB? Does it generate executables?

What exactly is MATLAB/Simulink? I've tried to understand it but have only gotten more confused in the process. I know that you can write programs utilizing high-level industry-specific functions and algorithms but: Is it a runtime where you can 'build' your code into an exectable program for a Client/Server? Is it only a simulation e...

Usage of MATLAB classes compiled to .NET

I compiled a MATLAB class to .NET, but instead of having my proper constuctor and methods in my class classdef Foo properties p1 p2 end methods function bar ... I have these functions in the .NET assembly: ~Algo() public Algo() public void Foo(int numArgsOut, ref MathWorks.MATLAB.NET.Arrays.MWArray[] argsOut, Mat...

Strange classes passed from matlab to java

I have some matlab code and some java code that need to talk. I was getting a NoSuchMethodError When I pass a matlab double array to a java method that accepts double[] argument. So i write a simple "hello world" to get the class of an object passed to the method public void printArray(Object array) { System.out.println(array....

Array of Matrices in MATLAB

Hello, I am looking for a way to store a large variable number of matrixes in an array in MATLAB. Are there any ways to achieve this? Example: for i: 1:unknown myArray(i) = zeros(500,800); end Where unknown is the varied length of the array, I can revise with additional info if needed. Update: Performance is the main reason I am...

How to check if a figure is opened and how to close it?

My m-file opens figures depending on parameters. Sometimes is one figure, sometimes it opens 2 figures. If the user call the function, the figures appear. If he calls the function again, with other parameters, I'm clearing figures with clf before the new plots. If the second call is set to draw only one figure, the second one (opened b...

Packages in MatLab for a beginner?

I need MatLab for 2D and 3D modeling. I have little experience in MatLab. Which packages should I study first to learn modeling in MatLab? ...