Answered
plot error
t=0:0.001:10; plot(0.25*exp(-t).*sin(2*t),t) You want an element by element multiplication so you need the '.' in front o...

15 years ago | 0

| accepted

Answered
RegionProps
I = rand(100)>.75; %sample binary image CC = bwconncomp(I); %Connected Components Analysis stats = regionprops(CC,'area','...

15 years ago | 0

| accepted

Answered
How to reverse datenum?
|datevec| or |datestr| doc datevec doc datestr %For future reference: since you're using datenum, the conversions are pro...

15 years ago | 1

| accepted

Answered
Black pixels to white
%I is your image M = repmat(all(~I,3),[1 1 3]); %mask black parts I(M) = 255; %turn them white This is only setting par...

15 years ago | 7

| accepted

Answered
ginput not recognizing axes with origin in upper right-hand corner
I would just write a quick wrapper function for ginput - you'll never even know! %Call it with this I = imread('cameraman.tif...

15 years ago | 0

| accepted

Answered
How to calculate a line-of-best-fit equation (y=mx+b) from a simple x-y dataset, and then to use this equation to calculate r-square?
doc polyfit and then doc polyval doc corrcoef like magic! Welcome to MATLAB Answers!

15 years ago | 1

| accepted

Answered
How do I round to the nearest arbitrary, enumerated value in MATLAB?
[~,idx] = min(bsxfun(@(x,y)abs(x-y),v,roundTargets.')); %index of closest vRounded = roundTargets(idx); %extract values Keywo...

15 years ago | 1

Answered
Plotting points as circle
plot(2,3,'ko','markerfacecolor','k')

15 years ago | 0

Answered
plotting 3-D data in 2-D
test = repmat(magic(3),[1 1 4]); %each vector into the third dimension will be the same (so we can verify accuracy) ...

15 years ago | 1

| accepted

Answered
I ask for the numerical value and it gives me the expression
double(ans) perhaps? or perhaps doc subs for s

15 years ago | 0

Answered
I need GUI Save As button for an image in a figure please.
You could have an edit box that has the the default file name but can be changed. Then when the save as button is called it sav...

15 years ago | 1

Answered
Printing in matrix form
No reason for a FOR-loop. grid = mean(test,3); %second input to mean is the dimension to mean along, in this case 3. To fi...

15 years ago | 1

| accepted

Answered
two lines skeletonization
Perhaps you could just change the connectivity for |bwboundaries|? Could you please post the (small) matrix that yielded the ...

15 years ago | 0

Answered
Finding maximum value, discounting a certain matrix place.
sweep2(ll) = []; %ll instead to make it more readable val = max(nonzeros(sweep2));

15 years ago | 0

Answered
Convert zeros to NAN
One of many ways idx = ~A; idx(:,1:2) = false; A(idx) = nan;

15 years ago | 0

| accepted

Answered
Underlay Image in Bar3 Plot
My function: <http://www.mathworks.com/matlabcentral/fileexchange/29485-meshcanopy FEX: meshCanopy> overlays a mesh on an image....

15 years ago | 0

Answered
How do I detect a change in a 3 frame sequence of images?
how about an image subtraction or absolute difference? doc imsubtract doc imabsdiff

15 years ago | 0

Answered
How to have simple text in a matrix
A = {'text1','text2','Hello World','Happy Birthday'} A{1} You need cell arrays doc cell for more info

15 years ago | 1

| accepted

Answered
How do I make something that labels the lines in my plot?
doc legend ? *Edited* %Demo H = zeros(4,1); %preallocate handle vector M = magic(4); %magic square to have each row plott...

15 years ago | 0

| accepted

Answered
Left digits
left3 = @(x)str2double(x(1:3)); left3(num2str(1234)) Perhaps? Or so it doesn't error on numbers < 100 left3 = @(x)str2dou...

15 years ago | 0

| accepted

Answered
Help with basic MATLAB syntax
# Open the editor and a new blank file or the command line # Copy the above into it That will have then been written in MATL...

15 years ago | 0

Answered
how to get thin image components ??
doc bwmorph and look at the "thin" option or "skel" option.

15 years ago | 1

Answered
How do I make an if, elseif, else statement?
Or the vectorized solution: y = repmat(500,size(x)); idx = 0<x&x<10; y(idx) = 4*x(idx); idx = 10<x&x<40; y(idx) = 10*x(...

15 years ago | 1

Answered
Getting X,Y coordinates and width,height of objects in an Image
doc bwconncomp doc regionprops

15 years ago | 0

Answered
Identifying characters from Image (OCR)
Sounds like an approach that could work... There are hundreds (thousands?) of OCR methods out there, they're not trivial, and...

15 years ago | 0

Answered
combining 3 different arrays of single column numbers into one array
I'm pretty sure there's a better way but this will work: cellfun(@(x)str2double(x(~isspace(x))),cellfun(@(x)num2str(x),mat2...

15 years ago | 0

| accepted

Answered
Is it contourplot or Isosurface?
contour contourf

15 years ago | 0

Answered
make replacements in an array
B must be a cell array. A = [0; 0; 1; 1; 0; 1]; B = repmat({'no'},size(A)); B(logical(A)) = {'yes'} Part 2 Numbs = {'one...

15 years ago | 0

| accepted

Answered
mouse button click
Yes. Look at the third output of |ginput| doc ginput

15 years ago | 0

Answered
Trying to get the solve command to work
I don't know why that's happening, but by breaking it into two lines I get an "explicit solution could not be found result" s...

15 years ago | 0

Load more