Réponse apportée
How to replace values less than equal to zero values in a matrix?
myMatrix( myMatrix <= 0 ) = NaN

plus de 7 ans il y a | 4

| A accepté

Réponse apportée
Background subtraction in an RGB Image
Well, you can do something like this: rgb = rand( 5, 5, 3 ); % Random image rgb( 2, 3, : ) = [0 0 0]; % Turn a pixel black rg...

plus de 7 ans il y a | 0

Réponse apportée
How do I make an array of numbers in the titles of a structure?
for n = 1:numel(U) u(n) = double( FU_antwoord.( ['U' num2str(n + 1)] ) ) end will put them in an array. Creating ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How do I stop the loop continuously going without giving a final answer? It is two separate functions that link together.
You are running a while loop on the variable |error| (which incidentally is a function name so you should not name a variable th...

plus de 7 ans il y a | 0

Réponse apportée
Why does matlab scale x-axis automatically
plot( x, y ) plots the values you want on the x axis. plot( y ) as you have done just defaults to using indices alo...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
I am trying to write a function for the Gamma Correction, this is what I have so far. the problem is the intensities of the output image is either 0 or 255. what am I doing wrong?
double(pixel/255) will divide pixel by 255 _then_ convert to a double. Assuming your image is an 8-bit integer data type t...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
K-means on a gray scale image
1. kmeans only supports double or single inputs. It works in floating point so integers wouldn't make sense. 2. doc re...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
I am trying to use K-means on a grayscale image
Without being able to run your code (I don't have 'lena.bmp' and can't be bothered to try to find it!), I is going to be of type...

plus de 7 ans il y a | 0

Réponse apportée
abstract class using implemented methods
Your functions are all static so they have no object scope. To override base class functions and have the code call the version...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to change the scale of the x-axis & y-axis?
doc interp2 is likely what you need if you want finer resolution to get rid of step-like features, but how was anyone to in...

plus de 7 ans il y a | 0

Réponse apportée
loop for while etc
n = 0:100000; s = 0.5 * sin( n / 33 );

plus de 7 ans il y a | 0

Réponse apportée
Output argument 'y' is not assigned on some execution paths
I can't be bothered to manually check every single |if| condition, but that error is telling you that with some inputs you gave ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
how to form feedback loop to change input?
Put the relevant part of the code in a while loop with the condition while Dm < -1 || Dm > 1 % Your main code here ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
arrayfun with multiple inputs and a different size output
c = arrayfun( @(x,y) rand( x, y ), 1:4, 3:6, 'UniformOutput', false ) works fine to produce outputs that are matrices. If ...

plus de 7 ans il y a | 0

Réponse apportée
how to display colorbar levels from '-10^6' to '10^6' ?
c = colorbar; labels=arrayfun(@(c)['10^',int2str(c)],-6:6,'uniformoutput',false); set( c, 'TickLabels', labels, 'Tic...

plus de 7 ans il y a | 0

Réponse apportée
Creating a new string matrix
s = string( {'abc';'ef';'xyz'} ) or s = [ "abc";"ef";"xyz" ] work, but your start point there is not valid syntax ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Copy the curve in the Axes of a Figure to the Axes of a GUI
If you have the handle of figure 1 as hFig then hLine = findobj( hFig.CurrentAxes, 'Type', 'line' ) or hLine = fin...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
extracting first letter from the cell
res = cellfun( @(x,y) [x(1) y(1)], nam1, nam2, 'UniformOutput', false' ) works fine for me on your example, but then so doe...

plus de 7 ans il y a | 0

Réponse apportée
Parsing varargin for a function called with values only instead of name-value pairs
function add_to_database(db, bird, where, when) if ~isempty( bird ) bird = validatestring( bird, { 'robin', 'car...

plus de 7 ans il y a | 0

Réponse apportée
How to assign values to a sparse matrix without iterations?
i = repmat( 1:size( Nonloc ), [1 2] ); j = Nonloc(:) s = sparse( i, j, 1 );

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Add values to vector
B( B == 1 ) = A

plus de 7 ans il y a | 0

Réponse apportée
How to combine two arrays?
[x; y]

plus de 7 ans il y a | 0

Réponse apportée
What is missing from MATLAB?
As a regular user of object oriented programming one of the things I miss most from C++ (where I started) is the ability to pass...

plus de 7 ans il y a | 1

Réponse apportée
How to change output ans?
doc format

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to maintain the same "xticks" and "yticks" for multiple plots?
doc linkaxes or doc linkprops if you need more fine control, but linkaxes should work fine, using the 'y' argument ...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
Calling a function with 2 inputs using only a single input
It depends how you want to handle it. Do you want 'b' to be an optional argument or do you want to force the caller to always gi...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to replace k-th diagonal by vector?
P is defined as a matrix of all zeros and you appear to be overwriting the 'diag' function with a variable of the same name whic...

plus de 7 ans il y a | 1

Réponse apportée
Function handle to randomly select the rows of ifft matrix for compressed sensing
f = @( ) randi( numRows );

plus de 7 ans il y a | 0

Réponse apportée
How can I color a (circle) area in a scatterplot?
doc scatter shows a 4-argument syntax which allows you to include a vector of colours of equal length to the x and y. So y...

plus de 7 ans il y a | 0

Charger plus