Réponse apportée
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...

presque 11 ans il y a | 1

Réponse apportée
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...

presque 11 ans il y a | 0

Réponse apportée
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;

presque 11 ans il y a | 1

Réponse apportée
how to change a variable?
SumLast = D; ind = ~any(A>B, 2); SumLast(ind) = C(ind);

presque 11 ans il y a | 0

Réponse apportée
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...

presque 11 ans il y a | 0

Réponse apportée
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...

presque 11 ans il y a | 0

Réponse apportée
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...

presque 11 ans il y a | 0

Réponse apportée
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(:))

presque 11 ans il y a | 0

| A accepté

Réponse apportée
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');

presque 11 ans il y a | 0

Réponse apportée
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);

presque 11 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 11 ans il y a | 2

| A accepté

Réponse apportée
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;

presque 11 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 11 ans il y a | 1

| A accepté

Réponse apportée
how to check if numbers in the vector is within range of 1:10
all(x >= 1 & x <= 10)

presque 11 ans il y a | 1

Réponse apportée
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, :)...

presque 11 ans il y a | 0

Réponse apportée
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...

presque 11 ans il y a | 1

| A accepté

Réponse apportée
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. ...

presque 11 ans il y a | 0

Réponse apportée
I got an error ignoring extra legend entries.
h = legend({'Banana' 'Rose' 'Strawberry' 'Vanilla'})

presque 11 ans il y a | 0

Réponse apportée
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])

presque 11 ans il y a | 0

Réponse apportée
How can I draw a parity plot?
plot(x,y, '.') line([0.5 3],[0.5 3])

presque 11 ans il y a | 1

Réponse apportée
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 :-))

presque 11 ans il y a | 0

Réponse apportée
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...

presque 11 ans il y a | 0

| A accepté

Réponse apportée
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...

presque 11 ans il y a | 1

| A accepté

Réponse apportée
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...

presque 11 ans il y a | 0

Réponse apportée
Help with plotting contour.
Use colorbar to add a colorbar that relates the colors to values, as in pcolor(peaks), colorbar

presque 11 ans il y a | 0

Réponse apportée
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...

environ 11 ans il y a | 0

| A accepté

Réponse apportée
Plotting a portion of a graph
plot(vector(50:70))

environ 11 ans il y a | 0

Réponse apportée
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...

environ 11 ans il y a | 1

| A accepté

Réponse apportée
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...

environ 11 ans il y a | 0

Réponse apportée
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);

environ 11 ans il y a | 0

Charger plus