Answered

how to interrupt a while loop??

In your GUI, set some user data to your GUI handle. In your loop, check this data and |break| accordingly.

how to interrupt a while loop??

In your GUI, set some user data to your GUI handle. In your loop, check this data and |break| accordingly.

8 years ago | 0

Answered

remove rows with all zeros

Search facility on Answers shows this question is asked a lot... Here's one of the more recent. <http://www.mathworks.com/ma...

remove rows with all zeros

Search facility on Answers shows this question is asked a lot... Here's one of the more recent. <http://www.mathworks.com/ma...

8 years ago | 0

Answered

Question on optimization problem and fminsearch,fminunc,lsqnonlin

Depending on how localised your minima are, you can sometimes get around this with a simplex-based solver like |fminsearch|. I ...

Question on optimization problem and fminsearch,fminunc,lsqnonlin

Depending on how localised your minima are, you can sometimes get around this with a simplex-based solver like |fminsearch|. I ...

8 years ago | 0

Answered

Reading two voltages from arduino.

Probably because you're asking it to read integers (%d), not floats (%f). Make that change. Also, beware of MatLab's |fscanf...

Reading two voltages from arduino.

Probably because you're asking it to read integers (%d), not floats (%f). Make that change. Also, beware of MatLab's |fscanf...

8 years ago | 0

| accepted

Answered

for and parfor

That's a thought-provoking question. "Faster" is not always a requirement in computing. Also, there are many algorithms or s...

for and parfor

That's a thought-provoking question. "Faster" is not always a requirement in computing. Also, there are many algorithms or s...

8 years ago | 0

| accepted

Answered

Add a colum and a row of blank (white) values in an Image

Your best options (as far as I know) are: 1. Resize the image twice (once for new row, once for new column) im(end+1, :)...

Add a colum and a row of blank (white) values in an Image

Your best options (as far as I know) are: 1. Resize the image twice (once for new row, once for new column) im(end+1, :)...

8 years ago | 1

Answered

Fitting data with two peaks

Define a function that accepts the parameters of the two lorenzian curves and computes the full curve. I don't know how many ...

Fitting data with two peaks

Define a function that accepts the parameters of the two lorenzian curves and computes the full curve. I don't know how many ...

8 years ago | 2

Answered

Change Secod Axis Color And Tick Label Colors

set(haxes(2), 'YColor', 'r');

Change Secod Axis Color And Tick Label Colors

set(haxes(2), 'YColor', 'r');

8 years ago | 2

Answered

Renumber an axis of a figure

You can replace the 'XTick' member of the axis. Here, I just use the handle to the current axis. x = 0:1.224:10; y = ra...

Renumber an axis of a figure

You can replace the 'XTick' member of the axis. Here, I just use the handle to the current axis. x = 0:1.224:10; y = ra...

8 years ago | 0

| accepted

Answered

Creating a desktop shortcut to run an mfile, Windows 7

A batch file to do this is almost exactly the same as a shortcut. You still need to know the MatLab install path. Now, I did a...

Creating a desktop shortcut to run an mfile, Windows 7

A batch file to do this is almost exactly the same as a shortcut. You still need to know the MatLab install path. Now, I did a...

8 years ago | 0

| accepted

Answered

Function using for loop

There's a pattern here... state1 = max( ceil(x(1) / 5), 1 ); state2 = max( ceil(x(2) / 5), 1 ); Just as a point on st...

Function using for loop

There's a pattern here... state1 = max( ceil(x(1) / 5), 1 ); state2 = max( ceil(x(2) / 5), 1 ); Just as a point on st...

8 years ago | 0

Answered

Leaving a blank line between inputs

input('\nsome question :', 's')

Leaving a blank line between inputs

input('\nsome question :', 's')

8 years ago | 1

| accepted

Answered

delete zeros rows and columns

Yeah you did too much! % Remove zero rows data( all(~data,2), : ) = []; % Remove zero columns data( :, all(~data...

delete zeros rows and columns

Yeah you did too much! % Remove zero rows data( all(~data,2), : ) = []; % Remove zero columns data( :, all(~data...

8 years ago | 7

Answered

String parsing

It kinda depends on how flexible you need to be. Are the tags ever in a different order? Is the format EXACTLY as given? Are ...

String parsing

It kinda depends on how flexible you need to be. Are the tags ever in a different order? Is the format EXACTLY as given? Are ...

8 years ago | 1

| accepted

Answered

Transfer a matrix in a quick way

If you want to preserve each 4x3 block, you could try something like this: B = reshape(A(:, [1:3:end, 2:3:end, 3:3:end]), [...

Transfer a matrix in a quick way

If you want to preserve each 4x3 block, you could try something like this: B = reshape(A(:, [1:3:end, 2:3:end, 3:3:end]), [...

8 years ago | 0

| accepted

Answered

Anyone using MATLAB on a LINUX OS??

MatLab directly supports many Linux flavours, including Red Hat: <http://www.mathworks.com/support/sysreq/current_release/linux....

Anyone using MATLAB on a LINUX OS??

MatLab directly supports many Linux flavours, including Red Hat: <http://www.mathworks.com/support/sysreq/current_release/linux....

8 years ago | 0

Answered

divide and conquer

<http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm>

divide and conquer

<http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm>

8 years ago | 0

Answered

Stop the for loop

Time for the most basic of debugging practises... After you calculate j, put in the following line of code: disp(j); ...

Stop the for loop

Time for the most basic of debugging practises... After you calculate j, put in the following line of code: disp(j); ...

8 years ago | 1

| accepted

Answered

Uncorrelated sinuoids

By 'uncorrelated', you just mean out-of-phase, right? This is about as simple as wave generation gets. Just work out how muc...

Uncorrelated sinuoids

By 'uncorrelated', you just mean out-of-phase, right? This is about as simple as wave generation gets. Just work out how muc...

8 years ago | 0

Answered

Detect a human figure in a live video

Employ a 2 year-old child to sit in front of the screen and "point at the person". This solution is 100% accurate with absolu...

Detect a human figure in a live video

Employ a 2 year-old child to sit in front of the screen and "point at the person". This solution is 100% accurate with absolu...

8 years ago | 0

Answered

summation inside a "for loop"

I would expect this to work: B = zeros(length(q), size(A,2)); for j = 1:length(q) B(j,:) = sum( exp(q(j)*A) ); e...

summation inside a "for loop"

I would expect this to work: B = zeros(length(q), size(A,2)); for j = 1:length(q) B(j,:) = sum( exp(q(j)*A) ); e...

8 years ago | 0

| accepted

Answered

Image acquisition-skipping frames

Those images are 512 * 512 * 1 ? That's 256kB. These are small. What is your frame rate? I'll assume 50 fps. That's 12.5 MB...

Image acquisition-skipping frames

Those images are 512 * 512 * 1 ? That's 256kB. These are small. What is your frame rate? I'll assume 50 fps. That's 12.5 MB...

8 years ago | 0

Answered

needs to get projection of one point from one x-axis to another

Have I understood correctly? You have |xred| and |xmag| which are two different ranges. You want to translate the x-coord from...

needs to get projection of one point from one x-axis to another

Have I understood correctly? You have |xred| and |xmag| which are two different ranges. You want to translate the x-coord from...

8 years ago | 0

Answered

Arrays of structures indexing

Start by working out which structures had a result: bValid = ~cellfun( @isempty, ind ); Now, you need to find the row in...

Arrays of structures indexing

Start by working out which structures had a result: bValid = ~cellfun( @isempty, ind ); Now, you need to find the row in...

8 years ago | 0

Answered

sorting columns with empty cells

You don't _have_ to use |datenum| to sort this data - I find |datenum| too slow and I generally avoid it. I prefer to represent...

sorting columns with empty cells

You don't _have_ to use |datenum| to sort this data - I find |datenum| too slow and I generally avoid it. I prefer to represent...

8 years ago | 0

Answered

How to generate 0 and 1 with equal probability using 'randi' function?

You did it backwards. Do this: nums = randi([0 1], M, N) Please note that while there is equal probability of randomly ...

How to generate 0 and 1 with equal probability using 'randi' function?

You did it backwards. Do this: nums = randi([0 1], M, N) Please note that while there is equal probability of randomly ...

8 years ago | 6

| accepted

Answered

calculate the Coding delay

Do this: tic doStuffThatYouWantToTime(); toc

calculate the Coding delay

Do this: tic doStuffThatYouWantToTime(); toc

8 years ago | 1

| accepted

Answered

Matlab simplify boolean expression

The expression: (A && B) || (A && ~B) Is logically equivalent to: A The reason is that both terms require |A| to...

Matlab simplify boolean expression

The expression: (A && B) || (A && ~B) Is logically equivalent to: A The reason is that both terms require |A| to...

8 years ago | 1

Answered

Efficiently populating an array without for loops

Hah... So an alternative in Order(N) time... for n = 1:size(MyData,1) row = MyData(n, [1,2,3]); ObjectTypes(row(...

Efficiently populating an array without for loops

Hah... So an alternative in Order(N) time... for n = 1:size(MyData,1) row = MyData(n, [1,2,3]); ObjectTypes(row(...

8 years ago | 0

| accepted

Answered

Efficiently populating an array without for loops

Yeah that's searching through your data an awful lot every time you do the |==| comparisons. The way I do this kind of thing wh...

Efficiently populating an array without for loops

Yeah that's searching through your data an awful lot every time you do the |==| comparisons. The way I do this kind of thing wh...

8 years ago | 0