Answered
How to make a surface plot of a n*3 matrix
surf(m(:,1),m(:,2),m(:,3)) where |m| is your matrix. This is exactly the syntax that the <https://www.mathworks.com/help/mat...

10 years ago | 0

Answered
How can I specify the colormap scalling
You need to create a linear correspondence between the colormap intervals and the desired data intervals. You basically have two...

10 years ago | 0

| accepted

Answered
Error using * matrix dimensions must agree?
Your question states that 1st dim should correspond to the |x|, and the 2nd dim to |t|. But where are you specifying that? Both ...

10 years ago | 0

| accepted

Answered
Comparing my array to two variables
Simply use <http://www.mathworks.com/help/matlab/ref/max.html |max|> and <http://www.mathworks.com/help/matlab/ref/min.html |min...

10 years ago | 1

Answered
assign a string matrix in each row and column
A[k:] = fgets(fid); is not MATLAB syntax. It looks like Python syntax, and does not work with MATLAB. Instead of _guessin...

10 years ago | 0

Answered
Storing data in another array
Why do you need all of those loops? There is no point in making your code much more complicated than it needs to be: mydata ...

10 years ago | 0

| accepted

Answered
Need help with Matlab - I get an error
@Mitch Byatt: you do not need a loop. Don't try to put lots of loops in everything and make code more complicated than it needs ...

10 years ago | 0

Answered
Add new data into existing mat file
The <https://de.mathworks.com/help/matlab/ref/save.html |save|> documentation gives this syntax: save(filename,variables,'-a...

10 years ago | 18

| accepted

Answered
How to create a list with all variables to let user choose those he wants for
Try to access variable names dynamically will be buggy any slow, and is not recommended. No matter how much beginners love inven...

10 years ago | 2

| accepted

Answered
All combinations of matrix elements?
*Method One: matrix multiply and |tril|:* You can use a simple <https://www.mathworks.com/help/matlab/ref/mtimes.html matrix ...

10 years ago | 2

| accepted

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: Use more Efficient Ways to Pass Variables between Workspaces (applies to evalin, assignin, etc) Use nested functio...

10 years ago | 6

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Other Languages: do not use eval! In case you think that avoiding dynamic variable names is just some "weird MATLAB thing", her...

10 years ago | 8

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: load into a Structure, not into the Workspace The MATLAB documentation explains this in detail: https://www.mathw...

10 years ago | 8

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: Non-Scalar Structure (with Indexing) Using a non-scalar structure is much simpler than trying to access dynamic va...

10 years ago | 7

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: Dynamic Field-Names in a Structure dynamic fieldnames are easy to use, and do not require string evaluation. http...

10 years ago | 8

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: Indexing into Cell Array or ND-Array Oftentimes when a user wants to use eval they are trying to create numbered v...

10 years ago | 8

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Confuses Data with Code The inclusion of data and meta-data within variable names (e.g. naming a variable with the user's input...

10 years ago | 6

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Code Helper Tools do not Work The MATLAB editor contains many tools that advanced users continuously make use of, and beginners...

10 years ago | 9

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Obfuscated Code Intent What does this code do?: x1 = [119,101,98,40,39,104,116,116,112,58,47,47,119,119,119]; x2 = [46,121,11...

10 years ago | 9

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Difficult to Work With Many beginners come here with questions that are basically some version of "I have lots of numbered vari...

10 years ago | 10

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Security Risk eval will evaluate any string at all, no matter what commands it contains. Does that sound secure to you? This st...

10 years ago | 10

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Buggy Using eval makes it really hard to track down bugs, because it obfuscates the code and disables lots of code helper tools...

10 years ago | 9

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Slow The MATLAB documentation Alternatives to the eval Function explains that code that uses eval is slower because "MATLAB® co...

10 years ago | 10

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Some quotes from <https://www.mathworks.com/matlabcentral/profile/authors/493281-steven-lord Steven Lord>, responses to inapprop...

10 years ago | 9

| accepted

Discussion


TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Summary: Dynamically accessing variable names can negatively impact the readability of your code and can cause it to run slower...

10 years ago | 83

Question


TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Summary: Dynamically accessing variable names can negatively impact the readability of your code and can cause it to run slower...

10 years ago | 20 answers | 79

20

answers

Answered
GUI, Handles saved in variable
Why are you trying to construct a string? If you have a structure, then do this: A = handles.(get(hObject,'Tag')); And re...

10 years ago | 0

| accepted

Answered
I need to find the minimum at what radius is the surface area smallest (use the “min” function in MATLAB, see MATLAB help for proper syntax of the min function) but I just can't get it to work.
[m,i]=min(A(r)) Note that this will only get the minimum function value for the values in vector |r|. If you want to obtain ...

10 years ago | 1

| accepted

Answered
how to get the min in an array and return its position?
>> x = [1,3,1,1]; >> minval = min(x) minval = 1 >> idx = find(x==minval) idx = 1 3 4 This kind of ba...

10 years ago | 1

Answered
How I make a pushbutton invisible in a GUI?
Setting the |Visible| property to |off| will not work, because then the |uicontrol| does not respond to clicking. Here are tw...

10 years ago | 1

Load more