Answered
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...

11 years ago | 1

Answered
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...

11 years ago | 0

Answered
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;

11 years ago | 1

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

11 years ago | 0

Answered
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...

11 years ago | 0

Answered
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...

11 years ago | 0

Answered
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...

11 years ago | 0

Answered
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(:))

11 years ago | 0

| accepted

Answered
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');

11 years ago | 0

Answered
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);

11 years ago | 0

| accepted

Answered
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...

11 years ago | 2

| accepted

Answered
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;

11 years ago | 0

| accepted

Answered
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...

11 years ago | 1

| accepted

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

11 years ago | 1

Answered
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, :)...

11 years ago | 0

Answered
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...

11 years ago | 1

| accepted

Answered
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. ...

11 years ago | 0

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

11 years ago | 0

Answered
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])

11 years ago | 0

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

11 years ago | 1

Answered
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 :-))

11 years ago | 0

Answered
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...

11 years ago | 0

| accepted

Answered
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...

11 years ago | 1

| accepted

Answered
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...

11 years ago | 0

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

11 years ago | 0

Answered
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...

11 years ago | 0

| accepted

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

11 years ago | 0

Answered
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...

11 years ago | 1

| accepted

Answered
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...

11 years ago | 0

Answered
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);

11 years ago | 0

Load more