Answered

Double sum of a series

Why do you want to implement you own convolution when Matlab already has a very fast function for that? For loops are slow. ...

Double sum of a series

Why do you want to implement you own convolution when Matlab already has a very fast function for that? For loops are slow. ...

6 years ago | 0

Question

Understanding MATLAB file access

Hello, I'm working on a script where I have to read hundreds of images and do some calculations on them. I'm using a simple f...

6 years ago | 1 answer | 0

Question

What is drawnow doing?

Hello everyone. I'm working on a code where I need to alternate the display of two complex plots in a very short time. The ti...

7 years ago | 1 answer | 0

Question

Optimization of variable-length array

Hello, I'm trying to optimize a code where I have an array with unknown size and I'm not sure about two solutions that I have...

7 years ago | 0 answers | 1

Answered

Discrepancy between xcorr2 and fft2

I figured it out by myself, and I uploaded a script on the file exchange to get a numerically equivalent function of xcorr2 whic...

Discrepancy between xcorr2 and fft2

I figured it out by myself, and I uploaded a script on the file exchange to get a numerically equivalent function of xcorr2 whic...

7 years ago | 0

Question

Discrepancy between xcorr2 and fft2

Hello! I want to implement an fft cross-correlation in my algorithm in order to replace the much slower xcorr2. In theory, d...

7 years ago | 1 answer | 0

Question

Does keyboard slows down the code?

Hello. I was doing some tests to speed up my code, and I realized that having a keyboard in the code slows it down, even if t...

7 years ago | 1 answer | 0

Question

Parfor loop and variable length output

Hello everyone, I would like to speed-up a code using a parfor loop but my function is not straightforwardly suitable for it....

8 years ago | 1 answer | 0

Question

Boolean matrix in mex file

Hello everyone, I'm trying to read a logical matrix in a mex file with matlab. The way I usally do for reading matrices in ma...

8 years ago | 1 answer | 0

Question

Automatically generate functions from snippet of a script

Hello, When I write a code in matlab, I usually start writing a script. When the script gets bigger, I transform it into a fu...

8 years ago | 0 answers | 1

Answered

Does it possible to use a function with persistent variables several times?

If you want to clear the persistent variable you need to do it explicitly: clear example

Does it possible to use a function with persistent variables several times?

If you want to clear the persistent variable you need to do it explicitly: clear example

8 years ago | 0

Answered

Mex results different from linux to windows!

I answer myself. The problem was related to the function abs. In gcc, math.h has a C version of abs that works on integers, so g...

Mex results different from linux to windows!

I answer myself. The problem was related to the function abs. In gcc, math.h has a C version of abs that works on integers, so g...

8 years ago | 0

| accepted

Question

Mex results different from linux to windows!

Hello everyone. I have a mex routine written in C++ that I use on a Windows computer compiled through Visual Studio. Now I ne...

8 years ago | 1 answer | 0

Answered

may i directly convert video to text document using matlab ?

You can use matlab OCR function: <http://uk.mathworks.com/help/vision/examples/recognize-text-using-optical-character-recogni...

may i directly convert video to text document using matlab ?

You can use matlab OCR function: <http://uk.mathworks.com/help/vision/examples/recognize-text-using-optical-character-recogni...

8 years ago | 0

Answered

how to display a query image and database side-side ? i have few lines but i am not able to proceed ahead with them as they are incomplete .

Maybe you want to use subplot: figure subplot(1,2,1) imshow(im1) subplot(1,2,2) imshow(im2)

how to display a query image and database side-side ? i have few lines but i am not able to proceed ahead with them as they are incomplete .

Maybe you want to use subplot: figure subplot(1,2,1) imshow(im1) subplot(1,2,2) imshow(im2)

8 years ago | 0

Answered

How to stop printing anything to command window?

The best solution would be using disp inside an if statement. A really bad soulution (still working) would be replacing the fun...

How to stop printing anything to command window?

The best solution would be using disp inside an if statement. A really bad soulution (still working) would be replacing the fun...

8 years ago | 0

Answered

script running for 13 hours. should I be worried?

You can use a task manager to check if matlab is still using the CPU. If not, it probably got stuck.

script running for 13 hours. should I be worried?

You can use a task manager to check if matlab is still using the CPU. If not, it probably got stuck.

8 years ago | 0

Answered

Find the distance between object and camera

Calculating the distance between an object and a camera in not an easy task. In theory, you would need two different cameras bec...

Find the distance between object and camera

Calculating the distance between an object and a camera in not an easy task. In theory, you would need two different cameras bec...

8 years ago | 0

Answered

Why are vectors horizontally and matrices vertically indexed?

Matlab variables are always indexed vertically. What you are talking about is a plot behaviour: plot(X,Y) plots vector Y v...

Why are vectors horizontally and matrices vertically indexed?

Matlab variables are always indexed vertically. What you are talking about is a plot behaviour: plot(X,Y) plots vector Y v...

8 years ago | 0

Answered

estimate time needed for a code to finish

This is my favourite solution: tic for i = 1:1e9 if toc > 10 fprintf('Iteration %d/%d\n',i,1e9) ...

estimate time needed for a code to finish

This is my favourite solution: tic for i = 1:1e9 if toc > 10 fprintf('Iteration %d/%d\n',i,1e9) ...

8 years ago | 2

| accepted

Answered

Calculating statistical PDF and percentiles over matrices

You can replace x with x(:) in prctile. The whole matrix will be squeezed in a single vector what will be evaluated just once.

Calculating statistical PDF and percentiles over matrices

You can replace x with x(:) in prctile. The whole matrix will be squeezed in a single vector what will be evaluated just once.

8 years ago | 0

Answered

The definition of variables

You can create integer random vectors with randi(), convert it to binary with de2bi(), and convert input binary to decimal with ...

The definition of variables

You can create integer random vectors with randi(), convert it to binary with de2bi(), and convert input binary to decimal with ...

8 years ago | 0

| accepted

Answered

HELP with Undefined variable, size of the indicated variable changes with each loop iteration.

The variable files is a cell array, and you are trying to refer it as a matrix. You should use files{i} instead of files(i,1) wh...

HELP with Undefined variable, size of the indicated variable changes with each loop iteration.

The variable files is a cell array, and you are trying to refer it as a matrix. You should use files{i} instead of files(i,1) wh...

8 years ago | 0

Answered

how can i make my scattered 3 dimensional data points as a 3d surface?

tri = delaunay(k(:,1),k(:,2)); trisurf(tri,k(:,1),k(:,2),k(:,3))

how can i make my scattered 3 dimensional data points as a 3d surface?

tri = delaunay(k(:,1),k(:,2)); trisurf(tri,k(:,1),k(:,2),k(:,3))

8 years ago | 0

Answered

how to read audio file?

You can use audioread: http://uk.mathworks.com/help/matlab/ref/audioread.html

how to read audio file?

You can use audioread: http://uk.mathworks.com/help/matlab/ref/audioread.html

8 years ago | 0

| accepted

Answered

How to find the variance of an image in a special windows? variance(in 3*3 windows)

You can use the function conv2: A = imread('foo.bmp'); small_window = ones(3)/9; A_sq = conv2(A.^2,small_window,'s...

How to find the variance of an image in a special windows? variance(in 3*3 windows)

You can use the function conv2: A = imread('foo.bmp'); small_window = ones(3)/9; A_sq = conv2(A.^2,small_window,'s...

8 years ago | 0

Answered

Problem in Plot diagrams

I cannot see your attachment, but you can use any char you wish for your plot, just using text instead of plot: x = linspac...

Problem in Plot diagrams

I cannot see your attachment, but you can use any char you wish for your plot, just using text instead of plot: x = linspac...

8 years ago | 0

Answered

How to use threshold in this problem?

Supposed your image varies from o to 1, you could use a threshold in this way: THR = 0.5 above = image>=THR; imag...

How to use threshold in this problem?

Supposed your image varies from o to 1, you could use a threshold in this way: THR = 0.5 above = image>=THR; imag...

8 years ago | 0

| accepted

Answered

Distance from 3d point to an ellipse

A simple and straightforward solution could be discretizing the points of the ellipse, evaluating the distance from all the poin...

Distance from 3d point to an ellipse

A simple and straightforward solution could be discretizing the points of the ellipse, evaluating the distance from all the poin...

8 years ago | 0

Answered

How to convert an acceleration time graph, into a velocity time graph

You can integrate the acceleration vector with cumsum or cumtrapz to get the velocity, and again to get the space.

How to convert an acceleration time graph, into a velocity time graph

You can integrate the acceleration vector with cumsum or cumtrapz to get the velocity, and again to get the space.

8 years ago | 0

| accepted