Answered
Executing loop on certain numbers
You can execute over the vector backwards by using basic MATLAB <http://www.mathworks.com/help/matlab/math/matrix-indexing.html ...

11 years ago | 0

| accepted

Answered
Plotting matrix columns
It is not clear if you really require _subplots_, and the other answers are mixed on this too... If the plots are to be on the s...

11 years ago | 1

Answered
How to change original variable inside function?
MATLAB is pass-by-value, with some fancy inbuilt stuff to intelligently minimize memory usage. Variables are copied when they ar...

11 years ago | 3

| accepted

Answered
how to make a function that takes vector as input and generate matrix of its elements
<http://www.mathworks.com/help/matlab/ref/bsxfun.html |bsxfun|> would be perfect for this, without requiring any loops (i.e <htt...

11 years ago | 1

Answered
Can I change default settings of plot
Welcome to MATLAB! Setting the some default parameters can be achieved by following these steps: # Look up the <http://www...

11 years ago | 4

| accepted

Answered
Read csv files by regulare expression function
You could avoid the whole |regexp| thing entirely by using my |FEX| submission <http://de.mathworks.com/matlabcentral/fileexchan...

11 years ago | 0

Answered
how the slider works in matlab?
Basically to use a slider you will need to think about two main things when the slider is created: # the slider 'min' and 'ma...

11 years ago | 0

Answered
Which method is used by diff ---Matlab differentiation
If you are doing basic numeric calculations, then according to its documentation <http://www.mathworks.com/help/matlab/ref/diff....

11 years ago | 0

Answered
error using fprintf invalid file identifier use fopen .this code runs well on computer but not on laptop why?tell me why it is happen
It is most likely that <http://www.mathworks.com/help/matlab/ref/fopen.html |fopen|> is not successfully creating a file, so the...

11 years ago | 0

Answered
GUI String to Function to evaluate
If you want the code _"...without user thinking about matrix power or size matching..."_, then it may be simplest to evaluate th...

11 years ago | 1

Answered
Save a matrix as an image
*The Problem* A matrix of size 768x768x2580 is not supported by |imwrite|, as the documentation clearly states: _|A| — Ima...

11 years ago | 0

Answered
2D Random walk angle
Rather than doing this in a loop, which will be very slow and inefficient use of MATLAB, this can easily be written as <http://w...

11 years ago | 1

Answered
Undefined function or variable?
|TreeBagger| is in the statistics toolbox: http://www.mathworks.com/help/stats/treebagger.html You might need to do one of...

11 years ago | 1

Answered
how to find the nearest smallest power of 2 to an integer?
>> N = 6; >> pow2(floor(log2(N))) ans = 4 And it is even fully <http://www.mathworks.com/help/matlab/matlab_p...

11 years ago | 6

| accepted

Answered
How can I append arrays onto the same variable in a series of loops?
*Solution One: Vectorized* Your example uses |rand|, which lets you generate the whole 3D array directly by specifying the ou...

11 years ago | 0

Answered
-1 and 1 matrix
*Method One:* >> N = 5; >> 2*mod(ndgrid(1:N,1:N),2)-1 ans = 1 1 1 1 1 -1 -1 -1 -1...

11 years ago | 0

| accepted

Answered
How do i create two multi-dimensional arrays:  a 10 x 10 x 10 numerical array (3-D) anda 5 x 5 x 5 x 5 numerical array (4-D) where each value in each array corresponds to the multiplication of indices?
This can be done quite simply using <http://www.mathworks.com/help/matlab/ref/mtimes.html matrix multiplication> and a single <h...

11 years ago | 1

Answered
Need help creating a table in which each cell contains a pair( or more) of numbers
Planning your data structure well is half of the work done writing your code. Although cell arrays are great, if you do not need...

11 years ago | 0

Answered
Unique function not deleting duplicate rows.
It is likely that the data are <http://www.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html floating point> and...

11 years ago | 3

| accepted

Answered
Determining Quadrants in a Matrix
Actually you do not need these |if| statements at all: just use <http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/ l...

11 years ago | 0

Answered
Not enough input arguments. Need help please.
The green button on the toolbar runs code, but does not (by default) provide any arguments. You can use its default behavior for...

11 years ago | 2

Answered
How do I grab individual files from a directory path?
You can use <http://www.mathworks.com/help/matlab/ref/dir.html |dir|> to get a list of all of the files in a directory. It also ...

11 years ago | 0

| accepted

Answered
Element-wise interval conformity check
Do *not* use <http://www.mathworks.com/help/matlab/ref/lower.html |lower|> and <http://www.mathworks.com/help/matlab/ref/upper.h...

11 years ago | 0

| accepted

Answered
call a function from another function with one changing argument
The easiest, neatest and most bug-free way of passing values is to ... *pass variables*! Although beginners seem to love writ...

11 years ago | 0

Answered
Greater than & lesser than works reversed in an if-statement that breaks
Your arguments to <http://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html |&&|> are reversed. Read the docum...

11 years ago | 0

| accepted

Answered
I want some variables to appear in the (edit text box) in the gui along with some string info.
It is much neater and faster to use <http://www.mathworks.com/help/matlab/ref/sprintf.html |sprintf|>, rather than |num2str| and...

11 years ago | 0

| accepted

Answered
~feof doesnt woek properly, how to fix the problem.
Using |textscan| inside of a |while|-loop is a waste of |textscan|'s ability to read the whole file at once, and hacks like this...

11 years ago | 1

| accepted

Answered
problem with nested loop
You have |x| and |y| values, and it seems that you want to use these as indices for allocating data values into another matrix. ...

11 years ago | 0

| accepted

Answered
how to get the array values using as index of another array values
Just use the |in_zone| values as row indices like this: new array = [in_zone, out(in_zone,:)]

11 years ago | 0

Answered
How do I preallocate memory in a For loop code?
Here is a completely <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code> version using <http:/...

11 years ago | 0

| accepted

Load more