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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 1

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 1

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

fast 14 Jahre vor | 3

| akzeptiert

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

fast 14 Jahre vor | 2

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

fast 14 Jahre vor | 1

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 1

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 3

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 1

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 0

| akzeptiert

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

fast 14 Jahre vor | 0

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

fast 14 Jahre vor | 2

| akzeptiert

Mehr laden