Respondida
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)

más de 10 años hace | 0

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

más de 10 años hace | 0

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

más de 10 años hace | 1

Respondida
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,...

más de 10 años hace | 0

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

más de 10 años hace | 1

| aceptada

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

más de 10 años hace | 1

| aceptada

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

más de 10 años hace | 1

| aceptada

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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

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

más de 10 años hace | 0

Respondida
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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 1

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

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

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

más de 10 años hace | 1

| aceptada

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

más de 10 años hace | 0

Respondida
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) ...

más de 10 años hace | 0

Respondida
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); ...

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

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

más de 10 años hace | 2

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

más de 10 años hace | 0

Respondida
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)); ...

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 0

Respondida
division of two matrices
bsxfun(@rdivide, A, B)

más de 10 años hace | 0

Respondida
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); ...

más de 10 años hace | 0

| aceptada

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

más de 10 años hace | 1

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

más de 10 años hace | 2

Cargar más