matlab

Fastest language for FOR loops

Hi- I'm trying to figure out the best programming language for an analytical model I'm building. Primary consideration is speed at which it will run FOR loops. Some detail: The model needs to perform numerous (~30 per entry, over 12 cycles) operations on a set of elements from an array -- there are ~300k rows, and ~150 columns in the...

Visualize high dimensional field arrows?

Hi, I have a big list of tuples (a, b), where both a and b are 9-dimensional vectors from the same space. This essentially encodes states of a system and some transitions. I would like to visualize the field described by these tuples, as arrows pointing from a->b, either in 2D or 3D. One of my problems however is that this is not a wel...

erosion in Matlab

When I apply erosion to my image to find small ball or disk shaped objects, no matter how much I change the size of the structuring element it doesn't seem to work. Instead the entire image appears kind of smudged by the structuring elements. I can still see where the objects are, but it doesn't help me locate them. Is there a way to ref...

Constructing a matrix in matlab from values generated by for loop

Possible Duplicates: Matlab - building an array while looping Matrix of unknown length in MATLAB? How do you put all of the "a" values together to form a vector? for i=1:3 a=2+i end Also this is maybe a style question but when do you put a semicolon after the end in a for loop such as the one above, also is it proper ...

Substitute matlab for loop for function input arguments

Hi all Here is my question : I have A = 1xN matrix and B = 6xN matrix I also have a function F = @(x,y) ... What I want to do is to loop over the values of A and B in a way that each time the input arguments for F will be : A(1,i) and B(:,i) Is there a way to that for all values without using a for loop in order to gain some time...

Plotting images over a graph in Matlab

Hi all, Does anyone know how can one plot() a regular 2D plot in Matlab, and draw little images over that plot? Thanks for any tips. ...

Markers and the imagesc() function in matlab

How do you create a marker on a 2D image that is plotted using imagesc()? Is it even possible? ...

How do I plot the X and Y axes in a JPEG image?

This is related to http://stackoverflow.com/questions/3181290/matlab-how-to-avoid-jagged-image I want to plot the symbol "+" which represent the x,y coordinate. I used jpg as background while ploting. The color of the "+" is blue and plotted on the same image. There were many x,y coordinate which I read through LOOP. My problem is th...

I want to open an image then a push button becomes enabled in MATLAB. How to?

I have following matlab GUI code. clear all; clc; win = figure('units','points',... 'position',[200 250 500 400],... 'color',[.8 .8 .8],... 'menubar','none',... 'resize','off',... 'numbertitle','off',... 'name','test window'); menu = uimenu('parent',win,... 'Label','File'); submenu1 = uimenu('parent',menu,...

Suggestions to learn any programming language after Matlab

I've taken a course in C++ in my freshman year in undergrad. However once it was over I never employed it in any project or use. I am familiar with some average topics in C++ prior to where 'link list' starts. Once I got the opportunity to do my first project after Sophomore year, I was suggested by my prof. to learn Matlab which is wide...

MATLAB: unwrap function

I'm in a discussion with someone from Mathworks re: the unwrap function which has a "bug" in it for jump tolerances other than , and would like to get some other perspectives: Description Q = unwrap(P) corrects the radian phase angles in a vector P by adding multiples of 2 when absolute jumps between consecutive elements of...

Creating a standalone app from Matlab code

Hi, I have some Matlab code and a GUI for it and I want to make a standalone .exe so that it can be used on computers that don't have Matlab installed. I know about the Matlab compiler and how to use it, but that creates an .exe that only works if the user has the MATLAB Compiler Run-Time (MCR) installed. What I'm interested in, is if...

maybe matrix plot!

hi professionals! for an implicit equation(name it "y") of lambda and beta-bar which is plotted with "ezplot" command, i know it is possible that by a root finding algorithm like "bisection method", i can find solutions of beta-bar for each increment of lambda. but how to build such an algorithm to obtain the lines correctly. (i think so...

MATLAB how to perform cumsum which fullfill two conditions?

This question is related to http://stackoverflow.com/questions/3101893/how-can-i-perform-this-cumulative-sum-in-matlab. Is it possible to use TWO conditions to perform cumsum? or just one condition? EDITED: data = [1 22 20;... %# Initial data 1 22 22;... 1 22 20;... 1 44 11;... 0 44 12;... 1 33...

How to make Matlab include all the dimensions of the expression when error is thrown because dimensions not agree?

So I am debugging some Matlab code and I get the dimension-doesn't-agree-error for some expressions. It's all nice that Matlab points to the correct line etc. However it would be nice if Matlab would output the dimensions of the variables involved in the error text so I don't have to deal with sizing them up myself. Sometimes for a long ...

Accessing variables from a .m file

I run a program, which is a function - here I'll call it 'myfxn' - that outputs several different variables. But when I try to access the data I get ??? Undefined function or variable 'myfxn'. How do I access the data? Thanks for your help. ...

MATLAB calculates INV wrong (for singular matrices)

MATLAB calculate INV wrong sometimes: See this example [ 8617412867597445*2^(-25), 5859840749966268*2^(-28)] [ 5859840749966268*2^(-28), 7969383419954132*2^(-32)] If you put this in MATLAB it doesn't have inverse but in s calculator it has one. What is going on? ...

Matlab equivalent of Numpy broadcasting?

Hi, I'm trying to find some way to substract a size 3 vector from each column of a 3*(a big number) matrix in Matlab. Of course I could use a loop, but I'm trying to find some more efficient solution, a bit like numpy broadcasting. Oh, and I can't use repmat because I just don't have enough memory to use it (as it creates yet another 3*...

MATLAB: print pdf in black/white

Matlab prints figures in either black/white or color. A black/white print of a figure is NOT the same as a color print tweaked to black/white: every color including the light ones is translated as black. (Light colors that look good on screen or a color printer look horrible on a black/white printer) I would like to print a PDF file of ...

Color specifiy area of background of graph depending on condition

Hi, I have a bargraph (2D) and I want to make the background red for parts where another vector has a value > 1 i.e. example: graph = [2 3 5 4 9 1 7] color = [0 2 2 1 0 1 2] so the barplot will show usual bars and the background behind (including the space between the bars) is colored red behind the bars of "3","5" and "7" (positio...