Risposto
generation of random numbers inthe specified range ?
your_vals = 8.75 + (9.50 - 8.75).*rand(100,1);

quasi 14 anni fa | 0

Risposto
Figures displaying differently in and out of MATLAB
In order to preserve appearance, you could use a vector graphics format, such as .svg or .eps, instead of .png which is a bitmap...

quasi 14 anni fa | 1

| accettato

Risposto
Ploting A square around minima of a matrix
x = rand(100,1); y = rand(100,1) [idx idx] = min(y); plot(x,y,'.') hold on; plot(x(idx),y(idx),'s','MarkerSize'...

quasi 14 anni fa | 0

Risposto
decrease num of for loops
old_v = 0; for ii = 1:8*8*8*8 [u v x y] = ind2sub([8 8 8 8],ii); u = u-1; v = v-1; x = x-1; y = y-1; ...

quasi 14 anni fa | 0

Risposto
Run an M-file multiple times
for ii=1:1000 your_m_file_name %the .m is not necessary end Provided you are in the directory your m-file resides...

quasi 14 anni fa | 0

| accettato

Risposto
Problem when assigning vectors
b = zeros(numel(f),1);

quasi 14 anni fa | 1

Risposto
need a time series
totHours = 72; totMin = 12; totSec = 21; totVals = totHours*60*60+totMin*60+totSec; hour_vec = cell2mat(arra...

quasi 14 anni fa | 3

| accettato

Risposto
Weird spaces undetected by strfind
This sounds like an encoding problem. To find out what encoding your installation of Matlab uses: feature('DefaultCharacte...

quasi 14 anni fa | 2

Risposto
Generate random's number?
nVals = numel(your_stream); your_val = your_stream(randperm(nVals,1));

quasi 14 anni fa | 1

Risposto
How to compare a matrix row by row with specified condition
Maybe not the most efficient thing around, but here goes: A=[ 5 0 10 15 0.021 5 0 15 20 0.011 10 15 ...

quasi 14 anni fa | 0

| accettato

Risposto
How to output as a vector
Still <http://www.mathworks.com/matlabcentral/answers/51950-coin-toss-game-simulation going at it>. What's the meaning of _N ...

quasi 14 anni fa | 0

| accettato

Risposto
datenum with time in time vector
I don't think you get the same number. Try diff(tt) and you will see that they are different. Also, use f...

quasi 14 anni fa | 0

| accettato

Risposto
transform a cell in a column
A = cell2mat(A);

quasi 14 anni fa | 0

Risposto
How to plot multiple qqplot (Observed vs. Simulations) on same single figure with same regression line?
You can't. Why would you want to do that? Even if you could, what would the meaning be? It's not a regression line. A straight l...

quasi 14 anni fa | 0

| accettato

Risposto
Can these operations be vectorized?
There are ways, but it will probably be slower. For loops are not necessarily bad. Look at the answer <http://www.mathworks.com/...

quasi 14 anni fa | 0

Risposto
what kind function of this? Fit Constant Probability?
_constProb_ is not a built-in function. You can look at the source code yourself edit constProb Or you can post it her...

quasi 14 anni fa | 1

| accettato

Risposto
how to add string matrix to numeric matrix?
You could use cell arrays: a={'rice';'corn';'wheat'}; b={3;4;3}; your_result = cellfun(@(a,b) [a ' ' num2str(b)],a,b,...

quasi 14 anni fa | 0

Risposto
systematic: Do not use global, don't use eval
In small programs it's not a problem. If you are the only one that will be ever using your code, it should not be a problem. It ...

quasi 14 anni fa | 3

Risposto
Returning which button was pressed.
f = figure(1); click_type=get(f,'SelectionType'); if strcmp(click_type,'normal') %right click %Do some stuff el...

quasi 14 anni fa | 0

| accettato

Risposto
How can I select all the nonzero elements of a matrix and give out a matrix?
your_mat = A(A~=0); And if you want a sparse matrix: your_mat = sparse(A);

quasi 14 anni fa | 0

Risposto
numerical stable triangulation method?
# No. Both are valid Delaunay triangulations. # None, unless you write it yourself. You could always try the file exchange, may...

quasi 14 anni fa | 0

| accettato

Risposto
Is there something wrong with the find function?
From the documentation on the colon operator: j:i:k is the same as [j,j+i,j+2i, ...,j+m*i] In your vector _0.2_ would b...

quasi 14 anni fa | 1

| accettato

Risposto
Conversion from uint8 to ascii to number
Somewhat convoluted, depends on whether you can use _sprintf()_ and _sscanf()_: your_ascii = [48 46 56 52]; your_asci...

quasi 14 anni fa | 0

Risposto
Coin toss game simulation.
num_toss = 10; %Toss the coin vec_toss = rand(num_toss,1) > 0.5; %Get the average: mean_vec = cumsum(vec_toss)./(1...

quasi 14 anni fa | 0

| accettato

Risposto
Correct plot in matlab
Try: plot(Shear(:,1),Shear(:,2)); If you give a matrix as an argument to _plot()_ it will draw each column as independ...

quasi 14 anni fa | 0

Risposto
how can store two power 1000 value in matlab.
<http://en.wikipedia.org/wiki/Integer_(computer_science) You can't.>

quasi 14 anni fa | 0

Risposto
How can I use an return value from function1 in function2 (different m.files)?
You need to pass returnval1 to fun2: function returnval1 = fun1(input1,input2,input3) %do your stuff function f...

quasi 14 anni fa | 0

Risposto
What can I do to large scale array?
There are two limiters: data type and addressable memory. The data type will affect how much memory is needed. It can be solved ...

quasi 14 anni fa | 0

| accettato

Risposto
How do I create a create 'for' loop to compute time, position, velocity and add to running sum?
Indexes in Matlab start with one, not zero. _which_ever_array(0)_ will return an error. In your example, you could, amongst oth...

quasi 14 anni fa | 0

Risposto
Draw uninterrupted lines on a plot with missing values
idx = ~any(isnan(y),1); plot(x(idx),y(idx)); Also, you could use _nanmean()_ to get the mean in the presence of NaN'...

quasi 14 anni fa | 2

| accettato

Carica altro