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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

Beantwortet
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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 2

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 2

Mehr laden