Respondida
How to store a Fibonacci Sequence in an array using a for or a while loop?
After the first while loop you already have the array with the values, namely fib. A Cartesian plot would be plot(1:k, fit), for...

alrededor de 11 años hace | 1

Respondida
Precision issues when going from Fortran to Matlab
eps = 2^(-52) = 2.2204e-16 is Matlab's precision for double. e-20 is below this precision. In fact, it is below the precision o...

alrededor de 11 años hace | 0

Respondida
matrix if statement is above .5 then can I re enter it to show .5
R = randn(10)/3; R(R > 0.5) = 0.5; R(R < -0.5) = -0.5;

alrededor de 11 años hace | 1

Respondida
how to change a variable?
SumLast = D; ind = ~any(A>B, 2); SumLast(ind) = C(ind);

alrededor de 11 años hace | 0

Respondida
how to access cell array data with single for loop
C = flatten(A); D = flatten(B); using my function function [y, me] = flatten(x) %FLATTEN Flatten numeric data (N...

alrededor de 11 años hace | 0

Respondida
Help with plot legend
You have to get rid of the empty entries h(h==0) = []; name(cellfun(@isempty, name)) = []; before you can call l...

alrededor de 11 años hace | 0

Respondida
how to extend a cell array?
Sample cell C{1} = 100; C{2} = rand(2); C{3} = 'a'; % add zeros up to cell 23 C{23} = 0; z0{1} = 0; C(log...

alrededor de 11 años hace | 0

Respondida
RGB to HSV conversion then Generating a Histogram
This may get you started: I = imread('peppers.png'); HSV = rgb2hsv(I); H = HSV(:,:,1); % the hue plane hist(H(:))

alrededor de 11 años hace | 0

| aceptada

Respondida
filter function for aggregation of data
x = randi(10, [1 10]); % sample data F = 1/3*ones(1,3); % filter xm3 = conv(x, F, 'valid');

alrededor de 11 años hace | 0

Respondida
Histogram, change x/y-axis number jump marks
axis([0 40 0 1.1]) set(gca, 'XTick', 1:40); set(gca, 'YTick', 0:0.5:1);

alrededor de 11 años hace | 0

| aceptada

Respondida
having trouble with changing Matrix name
You can store matrices of different sizes in a cell array: for m=1:Nm for n=1:Nn A{m,n} = myfunction(m,n); end...

alrededor de 11 años hace | 2

| aceptada

Respondida
Attempted to access x_set(:,100); index out of bounds because size(x_set)=[7600,1] help
Rather than removing, set them to NaN. Otherwise you cannot preserve the 100x100 configuration: x(x<0) = NaN;

alrededor de 11 años hace | 0

| aceptada

Respondida
How to find common elements in two set and form a trio element set?
% define the pairs X = [1,2;1,3;1,4;2,4;2,5;3,4;3,5;4,5]; % compute indices of all possible combination of the pairs...

alrededor de 11 años hace | 1

| aceptada

Respondida
how to check if numbers in the vector is within range of 1:10
all(x >= 1 & x <= 10)

alrededor de 11 años hace | 1

Respondida
good evng matlab experts .i want to add 2 images of different sizes
You can extract the subimage S from image I using ind1 = 100:300; ind2 = 250:500; % sample values S = I(ind1, ind2, :)...

alrededor de 11 años hace | 0

Respondida
What is command or way to represent 8 images in 2 different figues ??
figure(1) subplot(2,2,1), imshow(I1) subplot(2,2,2), imshow(I2) subplot(2,2,3), imshow(I3) subplot(2,2,4), imshow(I4...

alrededor de 11 años hace | 1

| aceptada

Respondida
Is it possible to create a function for display variables with their names on figures?
That's impossible. If you pass the name, like display_in_plot('N', 'x'), the values of N and x are unknown inside the function. ...

alrededor de 11 años hace | 0

Respondida
I got an error ignoring extra legend entries.
h = legend({'Banana' 'Rose' 'Strawberry' 'Vanilla'})

alrededor de 11 años hace | 0

Respondida
Is it possible to create a function for display variables with their names on figures?
text(x, y, ['N = ' int2str(N) ', dt = ' num2str(dt) ', x = ' num2str(x) ', type = ' type])

alrededor de 11 años hace | 0

Respondida
How can I draw a parity plot?
plot(x,y, '.') line([0.5 3],[0.5 3])

alrededor de 11 años hace | 1

Respondida
Assign Numeric Values to List of Strings
That's easy Y = [ 1 1 + cumsum(diff(X - 'a' + 1) > 0)']; (and one of the reasons why I love Matlab :-))

alrededor de 11 años hace | 0

Respondida
Value not multiplying by -1
I would suggest to avoid the loop and use logical indexing: ind = Raw_data(i,3) == val; w(ind) = Raw_data(:,4); w(~in...

alrededor de 11 años hace | 0

| aceptada

Respondida
any returns 0 eventhough there is a non zero element in the row
Because it's just a vector (or 1 x N matrix), any(OECFINDEX) returns a single number, namely 1 in your example, and be...

alrededor de 11 años hace | 1

| aceptada

Respondida
clustering for a Matrix
For this example clustering would be probably overkill. It's sufficient to determine the distance to the values in the first col...

alrededor de 11 años hace | 0

Respondida
Help with plotting contour.
Use colorbar to add a colorbar that relates the colors to values, as in pcolor(peaks), colorbar

alrededor de 11 años hace | 0

Respondida
What about the character #?
There is no special thing with the hash. In some script languages it is used as the comment character, and I've seen things like...

alrededor de 11 años hace | 0

| aceptada

Respondida
Plotting a portion of a graph
plot(vector(50:70))

alrededor de 11 años hace | 0

Respondida
how to rectify the below error...
You don't have to close Matlab, just close all Probably you have opened files using fopen, and forgot to close them usin...

alrededor de 11 años hace | 1

| aceptada

Respondida
how to construct huffmandict for an image?
You need to count the occurrences of all unique values; hist does not do that by default, use histu instead: A = imread('le...

alrededor de 11 años hace | 0

Respondida
rearranging txt file in matlab
D = textscan(fopen('test.txt'), '%f'); % format to rows with N=26 values N = 26; D = reshape(D{1}, [], N);

alrededor de 11 años hace | 0

Cargar más