Respondida
Is it possible to have matlab go into debugging mode only when it hits a nan?
dbstop IF NANINF

más de 8 años hace | 0

Respondida
A breakpoint immediately after the execution of the code
Either add a breakpoint to the next line, or add a line that does nothing (like |1+1;|) and add a breakpoint to that.

más de 8 años hace | 0

Respondida
How can I disable the code folding in the editor?
Go to preferences, under Matlab->Editor/Debugger->Code Folding There you can enable/disable all code folding, and set what co...

más de 8 años hace | 2

| aceptada

Respondida
Effective way to convert/create matrix from mixed cell/string
array ={ [47.4500] '' [23.9530] '' [12.4590] [34.1540] '' [15.1730] '' [ 9.6840] ...

más de 8 años hace | 0

| aceptada

Respondida
How to erode images in MATLAB without <imerode>?
If you are allowed to use the |convn| function, you can use the code below. You need the comparator, because around the edges th...

más de 8 años hace | 0

Respondida
How to save all workspace variables and figures in a folder?
You can save all variables in the current workspace by using |save| without specifying any variable name, although this is inadv...

más de 8 años hace | 1

| aceptada

Respondida
How do I link my key.m nargin function (with switch statements) in my main.m script?
Just put the following line in your main.m file [cm, percentage] = key(T1,T2,T3); As long as key.m is on your Matlab pat...

más de 8 años hace | 0

Respondida
separating an image into two images
Convert the image to a grayscale (e.g. with |im2double|), invert (just do |IM=1-IM;|), and find the columns that sum to 0. Then ...

más de 8 años hace | 0

Respondida
How to get the opposite elements of a vector specified by an index?
|randsample| picks values from 1 to N, not 0 to N. The first block is for 1:N, the second for 0:N maxval=100; s = randsa...

más de 8 años hace | 0

| aceptada

Respondida
Why is my variable undefined?
Not all options for your if-structure will result in defining |g| if age<1 a=.4; else if (age>=1) && (age<...

más de 8 años hace | 1

Respondida
How to rotate a matrix?
You need to apply a conversion to the values inside the matrix, not the matrix itself. Using |meshgrid| is indeed helpful for ge...

más de 8 años hace | 0

| aceptada

Respondida
¿How to reproduce sound from one button (and let it loop) until press stop with other button?
Set a flag to true in your start function and play the sound in a loop. Check that flag every iteration of your loop. Your stop ...

más de 8 años hace | 1

| aceptada

Respondida
Help writing a for/while loop to identify and sort prime numbers
You already have a list of all the primes, so you don't need |isprime| anymore. What you now want to do is figure out the distan...

más de 8 años hace | 2

Respondida
Simple question about if statement
You should use logical indexing, like in the example below, or use a loop. LogicalIndexing=allorient(:,1)==1; allorient(...

más de 8 años hace | 0

| aceptada

Respondida
'Assignment has more non-singleton rhs dimensions than non-singleton subscripts'. Can you guys help me fixing this error?
The output of |sum| is a vector, as the input is a 2D matrix. To calculate the sum over all rows and cols, you can use the code ...

más de 8 años hace | 0

| aceptada

Respondida
Does the student edition of MATLAB have any limitations regarding the exporting of 3D graphs of surfaces to .stl files for 3D printing?
The stl file format is not owned by Mathworks. You can just write to it. There is even a <https://www.mathworks.com/matlabcentra...

más de 8 años hace | 0

| aceptada

Respondida
Workspace variables in R2015a
What dpd says is not entirely true. Some releases have a bug in displaying the min and max in the workspace window, but all at l...

más de 8 años hace | 0

| aceptada

Respondida
I have 98x3 matrix with only 7 unique rows of values which are output of some simulation. How do I extract that? I tried Unique function but am not getting unique rows. Below is the original matrix A and matrix after using unique function B.
This is probably due to rounding errors caused by the way |doubles| are stored in computers. You can use <https://www.mathworks....

más de 8 años hace | 0

| aceptada

Respondida
How do I plot many rows from many matrices made in a loop?
Your function looks like you could use |meshgrid| to generate the matrices that you need. ns=[1.5:0.01:1.6]'; B=ns./1.33...

más de 8 años hace | 0

Respondida
Expand a figure by clicking on the subplot, a opening a new figure.
If I recall correctly, there is a click callback property for |axes| objects, but I can't find it. You can always replicate this...

más de 8 años hace | 1

Respondida
how to insert "Filled Triangle" as text box in a Matlab figure?
You need the |amssymb| package to render this symbol. With some digging you should be able to add this package to your Matlab co...

más de 8 años hace | 0

Respondida
Math operations on array of objects
If each |A.b| contains one value, you could use <https://www.mathworks.com/help/releases/R2018a/matlab/ref/arrayfun.html |arrayf...

más de 8 años hace | 0

| aceptada

Respondida
How to save the textfiles in another paste?
Without actually having delved through your code, you could try the modification below. movefile(TXT_filefolders{ii}, 'C:\U...

más de 8 años hace | 0

| aceptada

Respondida
slope of a line when intercept is forced to zero
x = [1 2 3 4 5 6]; y = [11 61 111 161 211 261]; m=x(:)\y(:); You can find the doc if you look for <https://www.mathworks...

más de 8 años hace | 0

| aceptada

Respondida
Using push button to run function based on checkboxes
Move the code to the callback for your button and include an if-statement around that code that queries the state (the |Value| p...

más de 8 años hace | 0

Respondida
How do I place two columns side by side in the same column?
A = [1;2;3]; B = [4;5;6]; C = A.*10.^floor(log10(A)+1)+B;

más de 8 años hace | 0

Respondida
New values not saving in the matrix after each iteration
You are overwriting the result every iteration, instead of adding it to an existing vector. You could dynamically grow these vec...

más de 8 años hace | 1

| aceptada

Respondida
Given list of points in 3D, find the point that the euclidian sum of the distance is minimal
To extend your |f| function I have the following suggestions. The upper one mirrors your method, the second doesn't really. I do...

más de 8 años hace | 0

| aceptada

Respondida
create a matrix with the same entry
Something like this maybe? y=x*ones(NRows,1);

más de 8 años hace | 0

| aceptada

Respondida
How do I change a grid size?
The simplest way to do this is with <https://www.mathworks.com/help/releases/R2018a/matlab/ref/meshgrid.html |meshgrid|>.

más de 8 años hace | 0

Cargar más