Answered

I need to take characters out of a string using isnan and str2double.

cellfun(@(x) sscanf(x, '%f'), regexp(a, '(\d+)', 'match'))

I need to take characters out of a string using isnan and str2double.

cellfun(@(x) sscanf(x, '%f'), regexp(a, '(\d+)', 'match'))

8 years ago | 0

| accepted

Answered

How to extract coordinates from the pattern

white = 1; % or 255, depending on the format of your image [cy, cx] = ind2sub(size(I), find(I==1));

How to extract coordinates from the pattern

white = 1; % or 255, depending on the format of your image [cy, cx] = ind2sub(size(I), find(I==1));

8 years ago | 0

Answered

Plotting bar graph using loop

A=xlsread(filename); for i = 1:3, h = histogram(A(:,i+1), [0 0.3 0.5 Inf]); hi(i,:) = h.Values; end bar(hi) legend({'0:0....

Plotting bar graph using loop

A=xlsread(filename); for i = 1:3, h = histogram(A(:,i+1), [0 0.3 0.5 Inf]); hi(i,:) = h.Values; end bar(hi) legend({'0:0....

8 years ago | 0

Answered

three types of correlation coefficients for an image

I = im2double(imread('cameraman.tif')); c_diag = corrcoef(I(1:end-1, 1:end-1), I(2:end, 2:end)) c_vert = corrcoef(I(1:end-1...

three types of correlation coefficients for an image

I = im2double(imread('cameraman.tif')); c_diag = corrcoef(I(1:end-1, 1:end-1), I(2:end, 2:end)) c_vert = corrcoef(I(1:end-1...

8 years ago | 0

| accepted

Answered

Why is my Plot Blank?

You don't need the for loop, you can work on the vector beta. You just have to replace * and / with .* and ./ (you already use ....

Why is my Plot Blank?

You don't need the for loop, you can work on the vector beta. You just have to replace * and / with .* and ./ (you already use ....

8 years ago | 0

Answered

Finding a chain in an adjacency matrix

You can use the power of the adjacency matrix as detailed in <http://math.stackexchange.com/questions/222429/graph-theory-sh...

Finding a chain in an adjacency matrix

You can use the power of the adjacency matrix as detailed in <http://math.stackexchange.com/questions/222429/graph-theory-sh...

8 years ago | 0

Answered

want to make a number of row matrix from a single row matrix

Your description is somewhat unclear to me. Do you mean cat(3, reshape(line1, [3 3])', reshape(line2, [3 3])')

want to make a number of row matrix from a single row matrix

Your description is somewhat unclear to me. Do you mean cat(3, reshape(line1, [3 3])', reshape(line2, [3 3])')

8 years ago | 0

Answered

line profile adding certain rows together

ind = [-3 -2 2 3] + rMiddle; % rows +/- 3 pixels from rMiddle, but without row rMiddle and the direct rows +/- 1 pixels ab...

line profile adding certain rows together

ind = [-3 -2 2 3] + rMiddle; % rows +/- 3 pixels from rMiddle, but without row rMiddle and the direct rows +/- 1 pixels ab...

8 years ago | 0

| accepted

Answered

How to select two matrices randomly from a set of N matrices and then randomly select a few rows from first selected matrix and then exchange with corresponding rows of other selected matrix.

Q = cat(3,A,B,C,D,E,F,G,H,I,J); kk = randperm(size(Q, 3), 2); % select 2 matrices from Q ii = randperm(size(Q, 1), 2); %...

How to select two matrices randomly from a set of N matrices and then randomly select a few rows from first selected matrix and then exchange with corresponding rows of other selected matrix.

Q = cat(3,A,B,C,D,E,F,G,H,I,J); kk = randperm(size(Q, 3), 2); % select 2 matrices from Q ii = randperm(size(Q, 1), 2); %...

8 years ago | 1

Answered

row-column confusion with squeeze

Squeeze squeezes out all singleton dimensions of X, *if X is not a matrix*. In case of C = squeeze(zeros(1,3,1)) who...

row-column confusion with squeeze

Squeeze squeezes out all singleton dimensions of X, *if X is not a matrix*. In case of C = squeeze(zeros(1,3,1)) who...

8 years ago | 1

Answered

How to find unique elements in a vector without using unique or find?

You can do this with for and if: suppose you have the numbers in x and want to generate the unique numbers in xu ...

How to find unique elements in a vector without using unique or find?

You can do this with for and if: suppose you have the numbers in x and want to generate the unique numbers in xu ...

8 years ago | 0

Answered

Merge a piecewise, parameterized Function

You can use logical indexing x = 1:100; y = [sin(x(x <= 20)) cos(x(x>20 & x <= 40)) tan(x(x>40))];

Merge a piecewise, parameterized Function

You can use logical indexing x = 1:100; y = [sin(x(x <= 20)) cos(x(x>20 & x <= 40)) tan(x(x>40))];

8 years ago | 0

| accepted

Answered

Undefined function 'x0' for input arguments of type 'double'.??

You try to evaluate x0(4*n) and it seems that x0 is not defined. It could be a variable, if 4*n is an index, or a functi...

Undefined function 'x0' for input arguments of type 'double'.??

You try to evaluate x0(4*n) and it seems that x0 is not defined. It could be a variable, if 4*n is an index, or a functi...

8 years ago | 0

| accepted

Answered

Only the last user input is being stored, the rest are being replaced by zeros in my array.

Move the fprintf(fid1, '%6.3f,',n,y,x,z); inside the for loop.

Only the last user input is being stored, the rest are being replaced by zeros in my array.

Move the fprintf(fid1, '%6.3f,',n,y,x,z); inside the for loop.

8 years ago | 0

Answered

combining planes of data

M = cat(3, plane1, plane2, plane3,[more planes], plane512);

combining planes of data

M = cat(3, plane1, plane2, plane3,[more planes], plane512);

8 years ago | 1

Answered

I have a problem with a plot

plot(x, y1); hold on plot(x, y2) or plot(x, y1, x, y2)

I have a problem with a plot

plot(x, y1); hold on plot(x, y2) or plot(x, y1, x, y2)

8 years ago | 1

Answered

Low computation efficiency of simple sentence in MATLAB

Instead of X = repmat(lambda_old1,1,4).*[W1(:,i),W3(:,i),W2(:,i),W4(:,i)]; if might be faster to use X = bsxfun(@time...

Low computation efficiency of simple sentence in MATLAB

Instead of X = repmat(lambda_old1,1,4).*[W1(:,i),W3(:,i),W2(:,i),W4(:,i)]; if might be faster to use X = bsxfun(@time...

8 years ago | 1

| accepted

Answered

How can I correct inhomogeneous intensity in image?

I = im2double(imread('blob.bmp')); y = mean(I(:, 1:100), 2); sigma = 30; % choosen by visual inspection G = f...

How can I correct inhomogeneous intensity in image?

I = im2double(imread('blob.bmp')); y = mean(I(:, 1:100), 2); sigma = 30; % choosen by visual inspection G = f...

8 years ago | 0

| accepted

Answered

How can I solve the " Index exceeds matrix dimensions" error for the following code ?

Don't use negative indices like -2, they are always invalid. Valid indices in Matlab start with 1 and end with the number of ele...

How can I solve the " Index exceeds matrix dimensions" error for the following code ?

Don't use negative indices like -2, they are always invalid. Valid indices in Matlab start with 1 and end with the number of ele...

8 years ago | 0

Answered

reading a .txt

First check if the encoding is ISO-8859-1, such that accents are read correctly: if ~strcmp(feature('DefaultCharacterSet'), ...

reading a .txt

First check if the encoding is ISO-8859-1, such that accents are read correctly: if ~strcmp(feature('DefaultCharacterSet'), ...

8 years ago | 0

Answered

i have to save colour thresholded images in different folder according to their rgb values , but i can't work ..all the images are showing with the imshow() function but it can't stored on different folder as per their rgb values..pls help this out

Something is wrong with your condition, "out" is undefined. You can write if(red>88 & red<111 & green >86 & green <104 &...

i have to save colour thresholded images in different folder according to their rgb values , but i can't work ..all the images are showing with the imshow() function but it can't stored on different folder as per their rgb values..pls help this out

Something is wrong with your condition, "out" is undefined. You can write if(red>88 & red<111 & green >86 & green <104 &...

8 years ago | 0

Answered

Randomize three chosen arrays in matlab

A = [0,0,1]; B=[0,1,0]; C=[1,0,0]; X = [A; B; C]; x = X(sub2ind(size(X), 1:3, randi(3, [1, 3])))

Randomize three chosen arrays in matlab

A = [0,0,1]; B=[0,1,0]; C=[1,0,0]; X = [A; B; C]; x = X(sub2ind(size(X), 1:3, randi(3, [1, 3])))

8 years ago | 0

Answered

concatenate all value in a matrix into one number

This works even if the numbers are not single digits, i.e., in in {1,2,...,9} v = [10 20 4]; num = sscanf(sprintf('%d', v...

concatenate all value in a matrix into one number

This works even if the numbers are not single digits, i.e., in in {1,2,...,9} v = [10 20 4]; num = sscanf(sprintf('%d', v...

8 years ago | 0

| accepted

Answered

Connecting line between different points obtained from a for-loop

x = 1:20; y = x+2; plot(x,y,'*-')

Connecting line between different points obtained from a for-loop

x = 1:20; y = x+2; plot(x,y,'*-')

8 years ago | 0

Answered

Matlab delete's value's from array

You remove all rows that contain a NaN in the line k(any(isnan(k),2),:)=[]; and then you assign the variables varia...

Matlab delete's value's from array

You remove all rows that contain a NaN in the line k(any(isnan(k),2),:)=[]; and then you assign the variables varia...

8 years ago | 0

Answered

how can i find the displacement in pixels for the 1st, 3rd and 5th squares in the picture

% number here found by visual inspection I = im2double(imread('1.JPG')); index_center = size(I,2)/2+100:size(I,2...

how can i find the displacement in pixels for the 1st, 3rd and 5th squares in the picture

% number here found by visual inspection I = im2double(imread('1.JPG')); index_center = size(I,2)/2+100:size(I,2...

8 years ago | 1

| accepted

Answered

Change the default filling of a matrix

I do not know anyway to change the default behaviour of Matlab to fill the empty positions with zeros. So you have to do it in t...

Change the default filling of a matrix

I do not know anyway to change the default behaviour of Matlab to fill the empty positions with zeros. So you have to do it in t...

8 years ago | 0

Answered

Trying to make a "snake" matrix?

N = 5; M = 9; T = reshape(1:M*N, [M, N])'; T(2:2:end,:) = fliplr(T(2:2:end,:));

Trying to make a "snake" matrix?

N = 5; M = 9; T = reshape(1:M*N, [M, N])'; T(2:2:end,:) = fliplr(T(2:2:end,:));

8 years ago | 0

| accepted