I is not a real numeric array of class SINGLE [closed] - matlab

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm using the computer vision: VLfeat library to compute a HOG descriptor of an image, and after inputing this code:
cellSize = 8 ;
hog = vl_hog(im, cellSize, 'verbose') ;
I get this error in MATLAB, and when I google it I really can't find any possible explanation:
Error using vl_hog
I is not a real numeric array of class SINGLE.
After going over the code (found here) I'm also not sure what the variable I is:
Hopefully, I haven't missed something elementary ...
library source

As the asker already found out, the I refers to the first input argument.
Hence this should solve the problem:
hog = vl_hog(single(im), cellSize, 'verbose')

Related

Matlab - plot data from array of structs [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have an array of structs. Every struct holds a set of data for one single measure. Matlab gives me an error when I try to plot this data.
Expected one output from a curly brace or dot indexing expression, but there were 361 results.
How should I rewrite my plot code?
plot(result.structArray_A(:).nonArrayValue_X, result.structArray_A(:).nonArrayValue_Y);
I have found a solution. Simply writing the following does work, even if the syntax does look odd:
plot([result.structArray_A.nonArrayValue_X], [result.structArray_A.nonArrayValue_Y]);

MATLAB help for cell disruption modelling [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i keep getting the error "Error using -""Matrix dimensions must agree"
for this piece of code. Can anybody help me and identify where i'm going wrong? I should be getting 8 plots of f vs d.
P=500;
N=1:1:8;
a=-0.4;
b=-1;
Kd=700;
d50star=(1./(10.^(Kd*(N.^a)*(P-115).^b)))
w0=0.45;
d=0:0.1:10
d50N0=5;
if d50star < 0.33;
w=(1-(2.3*d50star))*w0
else
w=(3.4-(5.5*d50star))*w0
end
d50=(1-d50star)*d50N0;
f=1-(1./((1+exp((d-d50)/w))))
There are at least two errors in the script:
1) in the last line [f=1-(1./((1+exp((d-d50)/w))))]
d size is 1x101
d50 size is 1x8
The size inconsistency is related to the definition of:
N=1:1:8; and
d=0:0.1:10
2) depending on the algoroth, it could be ./w instead of /w
Hope this helps.

Distance measurement in Matlab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have tried the code from the link Ear Image Processing - Finding the point of intersection of line and curve in MATLAB
but seem to get an error as dist2s is undefined on matlab R2013a.Can anyone help me out
That's because you need to create the function (isn't defined by MatLab itself). Try saving this code in a file called dist2s.m and then setting the folder where it's located like current folder:
function out = dist2s(pt1,pt2)
out = NaN(size(pt1,1),size(pt2,1));
for m = 1:size(pt1,1)
for n = 1:size(pt2,1)
if(m~=n)
out(m,n) = sqrt( (pt1(m,1)-pt2(n,1)).^2 + (pt1(m,2)-pt2(n,2)).^2 );
end
end
end
return;
The code is provided in the same answer you refer to.

Matlab Vertcat function error [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Help I'm developing an application in matlab using the Vertcat functon.
But I got this error in Matlab..
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> imgMaskMed at 31
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:));
Here is my code where the error located
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:));
What is wrong with my code?
It's hard to know with the little information you provide, but my guess is that your copy_matrix has more than 2 dimensions. For example, if it's a 3D array you should use
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:,:));
If it's 4D use
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:,:,:));
and so on.

How to convert a structuring element to an binary image? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can you convert a structuring element to an binary image in MATLAB? For example, say I need to convert a square structuring element
se = strel('square',7)
Kindly help me in this matter. I really need a method or algorithm.
Use the getnhood method of the strel class:
NH = se.getnhood()
Returns an array NH as defined by the strel se. NOTE: NH is a binary (logical) image (matrix). You can display it as is or you can pad it as suggested by Jigg.
For future reference, you can use tab command completion to see the available methods for a class (hit TAB after typing se.), or you can use methods(se) to get a full list of available methods.
Technically, the array given by chappjc's code is a binary image.
Try displaying it like that:
nh = se.getnhood();
p=padarray(nh, [10 10], 0, 'both'); % This pads the array with zeros
imshow(p);