Réponse apportée
Can a program be written that can sort a set of words alphabetically?
Is this homework? Otherwise just use sort words = {'a' 'z' 'foo' 'bar' 'unsorted' 'help'} sort(words)

plus de 10 ans il y a | 0

Réponse apportée
RGB color value of plotyy purple bars
Try get(b, 'EdgeColor') get(b, 'FaceColor') With Matlab R2012a, I get black bars and get [0 0 0] for EdgeColor and 'f...

plus de 10 ans il y a | 0

Réponse apportée
what does A(ones(3,1),:)) do?
>> A = [1 2 3] A = 1 2 3 To select the first row of A, all columns (:) >> A(1,:) ans = 1 2 ...

plus de 10 ans il y a | 1

Réponse apportée
In a specific range, finding the first value over a specific value and maximum value
It's not clear to me what you want. I've you want to enter vectors of different length and find the first value and the maximum,...

plus de 10 ans il y a | 0

Réponse apportée
gather data from different sections of each column
You only need numelselect values of rows: B = randi(90,numselect,1); Then use for i = 1:numel(B), D(:,i) = A(B(i):B(i...

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
what does this error means-"Function definitions are not permitted at the prompt or in scripts."?
To define a function, create a new m-file on the command line >> edit myfun.m write your function in this file, first no...

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
Find Maximum Values of a 3 Dimensional Matrix
Reshape the pages of F into separate columns, determine the max for each column and use ind2sub to convert linear indices to sub...

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
I need to make a program that generates random numbers between 0 and 9999 for 5 seconds, and stops if the number 2015 is generated. I must use the etime and fix functions.
After I've replaced Disp with disp the program works fine. Another way to solve the task would be the following program; it uses...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How can I designate an image which had been plot some points on to be an variable?
You can use the following function to draw a line in an image: function I = bresenham(p1, p2, I) %Draws a white line fro...

plus de 10 ans il y a | 0

Réponse apportée
Reversing plot data to fit experimental to simualtion data
You can use fliplr and add some offset in y direction. data = fliplr(data) + yoffset;

plus de 10 ans il y a | 0

Réponse apportée
Print results using fprintf in required format
fprintf accepts only a single format string: for i = 1:numel(X), fprintf('The value of X%d = %0.1f\n',i, X(i)),end

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Display images in one figure
Use subplot: for i =1:Nimages I = ... % read ith image subplot(Nrows, Ncols, i), imshow(I) end

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
how to find predefined values indices in a matrix?
arrayfun(@(x) ST(find(ST(:,2)==x, 1, 'last'), 3), unique(ST(:,2)))

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How can I convert a dicom image into tiff?
To convert to tiff (e.g., uint16 dicom to uint16 tif): I = dicomread('../../Downloads/CR-MONO1-10-chest'); imwrite(I, 'che...

plus de 10 ans il y a | 1

Réponse apportée
Any way to use fplot to draw multiple curves in the same figure?
fplot(@(x)[tan(x),sin(x),cos(x)], 2*pi*[-1 1 -1 1])

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
nested for loop keeping i constant through all, until end of j's
Use two for-loops: for i=1:4 fprintf('i = %d, j = ', i) for j = 1:4 fprintf('%d,', j) end fprint...

plus de 10 ans il y a | 0

Réponse apportée
How can I avoid plotting zeros in data?
Sample data: y = zeros(1,100); y(1:10:100) = 1 + rand(1,10); plot(y) hold on Select only non-zero values for plotting...

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
Finding all possible combinations of a matrix
val = 0:3; X = []; for i = val, for j= val, for k = val, for l = val, X = [X; [i,j,k,l]]; end, end, end, end or ...

plus de 10 ans il y a | 0

Réponse apportée
How can I find the top 5% values' index in a 3D matrix
X = rand(10, 10, 3); % sample data [~, idx] = sort(X(:)); Linear indices: idxtop5perc = idx(end-5*numel(X)/100+1:end) ...

plus de 10 ans il y a | 0

Réponse apportée
Error using plot, vectors must be of the same length
Use a loop to determine the chid and chi values for different t tall = t; for i=1:numel(tall) t = tall(i); ...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Attempting to Crop binary image
The image contains some spurious white points, e.g. at (950,3). You can delete them using erosion se = strel('disk',1) e...

plus de 10 ans il y a | 0

Réponse apportée
Undefined function or variable 'X'
In the example, a variable X is stored in mask.mat and bust.mat, that are assinged to X1 and X2, resp., after loading. If you do...

plus de 10 ans il y a | 2

Réponse apportée
surf(Z) Z= 11x9 double produces a 10x8 surface
The full matrix is shown by surf. The numbers define the outer points of each patch: consider surf([1 2; 3 4]) that draw...

plus de 10 ans il y a | 0

Réponse apportée
how to use 2d matrix to index into 3d matrix
Use linear indexing N = size(C,1)*size(C,2); idx = [1:N]+(ID(1:N)-1)*N; B = reshape(C(idx), size(C,1), size(C,2)); ...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Neighbouring Gray Level Tone Dependence Matrix
Have a look at <http://stackoverflow.com/questions/25019840/neighboring-gray-level-dependence-matrix-ngldm-in-matlab>. It includ...

plus de 10 ans il y a | 0

Réponse apportée
division of two matrices
bsxfun(@rdivide, A, B)

plus de 10 ans il y a | 0

Réponse apportée
Sort one set of data to correspond to another.
If b is an unsorted version of a, i.e., all elements in b occur once and only once in a, you can use [~, idx] = sort(b); ...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
How to copy every 500 rows to a new variable?
Why do you want to create 60 new variables and double the data? That's not a good idea. You can keep your original data and just...

plus de 10 ans il y a | 1

Réponse apportée
why I get "out of memory" error when i use zeros(60000)?
You tried to allocate 60000*60000*8 = 28.8 GByte. That's seems to be too much for Matlab on your machine.

plus de 10 ans il y a | 2

Charger plus