Respondida
How do I make a section of a function runs only one time?
One way might be to use persistent variables. function out = myfunction(a,b,c) persistent S data_mdl if isempty(S) ...

alrededor de 4 años hace | 1

Respondida
The image changes color and position
I'm not sure why the image is upside-down, but the reason it's yellow is probably because it's a monochrome (single-channel) ima...

alrededor de 4 años hace | 1

Respondida
different file name in saving images
In whatever loop you're using, create the filename something like this: k = 10 % whatever number you need sprintf('Y_%03dmm.bm...

alrededor de 4 años hace | 0

| aceptada

Respondida
Transparency value in colormap
Colormaps and colorbars do not support RGBA formats (as far as I know). Transparency is handled separately by the AlphaData pro...

alrededor de 4 años hace | 0

| aceptada

Respondida
Create a vector using the even elements of another.
If I understand the question correctly: b = 10; N = 100; j = 1:2:N+1; del_y = b/N; i = 1:1:N+1; y_pos = -(b/2) + (i - 1)...

alrededor de 4 años hace | 0

Respondida
how to set decimal value to my matrix image index?
You have some problems with your code that's causing the result to not have the number of gray levels you expect. I think imsho...

alrededor de 4 años hace | 0

| aceptada

Respondida
How to generate a map of European countries coloured according to a vector of positive and negative values?
This should work. Note that the placeholder data isn't even integer-valued. % country names cou_nam = {'Belgium', 'Bulgaria',...

alrededor de 4 años hace | 1

| aceptada

Respondida
Plot conflicts with mathematical calculation
There are two poles. The function is undefined when the denominator is zero. The only reason it looks like the extrema vary is...

alrededor de 4 años hace | 0

| aceptada

Respondida
Plot two figures simultaneously
You can try something like this. There's some lag in between figure updates, but it's a start. % Data Layup Layup = [90 0 0 4...

alrededor de 4 años hace | 0

| aceptada

Respondida
how to find position of an element in a matrix which is present in another matrix?
a=[0.74 0.71 0.604 0.47 0.59 0.58 0.75]; b=[0.604 0.75]; % get the index of matches % ainb are the indices of elements of a...

alrededor de 4 años hace | 0

| aceptada

Respondida
Creating a blur brush tool for images
Doing the interactive painting routine sounds like it's going to be laggy and frustrating. That's one of the things I've long...

alrededor de 4 años hace | 0

Respondida
median filter on a region of interest
Just filter the whole image and then compose the two using a mask that defines the ROI. A = imread('cameraman.tif'); % make ...

alrededor de 4 años hace | 0

Respondida
I am trying to plot multiple data sets on one one diagram. When I use the plot function, I am not getting any data plots.
p02p01 is a scalar, so there's not really anything to plot. I imagine that's supposed to be a vector, but you're just overwriti...

alrededor de 4 años hace | 0

| aceptada

Respondida
Can someone please help me out with this MATLAB code. It is giving error "INDEX EXCEEDS THE NUMBER OF ARRAYS_ INDEX MUST NOT EXCEED 1" ON LINE 69
thetaa1t and thetaa2t are initialized as scalars thetaa1t((1)) = 0 ; thetaa2t((1)) = 0 ; I imagine you're trying to grow them...

alrededor de 4 años hace | 0

Respondida
2 unknowns in matching datasets
I'm sure there are other ways, but: load datasett.mat % omit nans nanmask = ~(isnan(Y1) | isnan(Y2) | isnan(Y3)); Y1 = Y1(...

alrededor de 4 años hace | 0

| aceptada

Respondida
How do I convert my RGB image to grayscale without using the Image Processing Toolbox?
EDIT: It's worth noting that as of R2014b, rgb2gray() no longer requires IPT. Still, if you're writing code for others and inte...

alrededor de 4 años hace | 0

Respondida
Change RGB image to gray without rgb2gray function
Assuming that the input is an RGB image and that the intended grayscale representation is luma and not something else: % get an...

alrededor de 4 años hace | 0

Respondida
i need negative image
It's best to avoid writing your code around unchecked assumptions of array class. If you have Image Processing Toolbox, imcompl...

alrededor de 4 años hace | 1

Respondida
Rotate an Ellipsoid towards a point
Try this: theta = linspace(0, pi, 25); phi = linspace(0, 2*pi, 25) ; x = 10*sin(theta)'*cos(phi); y = 1*sin(theta)'*sin(phi)...

alrededor de 4 años hace | 0

Respondida
Display original and processed image simultaneously in different UIAxes in App Designer
The images appear alternately because that's what the code plainly does. It shows one image, waits, shows another. It doesn't ...

alrededor de 4 años hace | 0

| aceptada

Respondida
How can the image be like this?
This is one way: A = imread('peppers.png'); imshow(A) B = zeros(size(A),class(A)); % black image B(100:250,200:350,:) = A(10...

alrededor de 4 años hace | 1

Respondida
Change for loop to while loop.
If you want to make things more complicated, you can: n = 5; %input ("Input a number: "); fprintf("\nOdd number: "); i = 1;...

alrededor de 4 años hace | 0

Respondida
Creating a contour plot with three row vectors
I answered a similar question recently. https://www.mathworks.com/matlabcentral/answers/1693130-how-to-use-a-contour-between-...

alrededor de 4 años hace | 2

| aceptada

Respondida
I'm trying to operate on each element of a row vector individually but unable to do so, as each element is containing a vector within itself.
I think what you're asking is to get the number of elements for each vector within the cell array. You can do that either with ...

alrededor de 4 años hace | 0

Respondida
Check if a binary image is within a particular binary area
I'm assuming your images are the same size, but contain objects of differing size. The intersection of two binary images A and ...

alrededor de 4 años hace | 1

| aceptada

Respondida
How do I draw overlapping circles wich change color?
Here's one way: % image setup sz = [600 600]; % image size cim = sz/2; % [y x] center of image r1 = 100; % radius of small c...

alrededor de 4 años hace | 0

Respondida
Help on while loop to make user enter an accepted value
pC can't be <0 && >100 This should fix the issue and simplify things pC = -1; % initialize while (~isnumeric(pC) || (pC<...

alrededor de 4 años hace | 1

Respondida
Code for making a reddish image from an RGB image
I've answered a couple very similar-sounding questions recently: How to make image "yellowish"? (explaining 'screen' blend, alt...

alrededor de 4 años hace | 0

Respondida
Why is my plot empty?
The plot doesn't display because all of the output values (except for tt = 0) are NaN. L is a relatively large number ~2E6, s...

alrededor de 4 años hace | 0

Respondida
How to "circularize" a 1-D plot into a 2-D image
Depending on what you need, this may be a start. % define TF curve tfr = [0 1.3 4]; tfz = [1 1 0.2]; % array setup maxxy = ...

alrededor de 4 años hace | 0

Cargar más