Answered
Passing data between UIFigures
app2.R = R; would work if you just want R, you don't need app1, but equally: app2.field3 = app.field3; for example ...

8 years ago | 1

Answered
Run every element through a function and return a new array
doc rowfun using func = @(x) a*x + b - 1; should work for this provided a and b are already defined at the point yo...

8 years ago | 4

| accepted

Answered
how to stop seeing rationals on matlab
doc format gives you the options, which I assume you know to have chosen 'rat' in the first place, but we don't know what y...

8 years ago | 0

Answered
Difference between columns, fixed the first column, in a matrix
res = max( 0, A(:,2:end,:) - A(:,1,:) ); _Note: This syntax only works from R2016b. For older syntax see Andrei Bobrov's a...

8 years ago | 2

| accepted

Answered
Problem related to locked axis.
Adding zoom reset after plotting the original will remember that as the current zoom which it will then zoom back out to...

8 years ago | 0

Answered
Output of Function in Form of 'Color',[0 0.2 0.4]!
Well, you can do: colourArgs = clrs('blue') plot([1 2],[1 2],'x', colourArgs{:}); if you are willing to accept two li...

8 years ago | 0

Answered
How to Change element values of an array with conditions?
A( A < 6 ) = A ( A < 6 ) + 10 Sadly Matlab doesn't have a neat += operator so you have to do the above rather ugly equivale...

8 years ago | 2

| accepted

Answered
How to change the double percent code section color?
It's under Preferences -> Colors -> Programming Tools -> Section display options

8 years ago | 6

| accepted

Answered
Getting rid of order of 10 axes labels
hAxes.YAxis.Exponent = 0; should work, off the top of my head. I don't have Matlab with me at the moment to check though.

8 years ago | 0

| accepted

Answered
zeros before a string using num2str
b = num2str(a,'0%3.4f')

8 years ago | 0

Answered
Hi...can we create a variable "a" with double array type ? . Thank.
a = 7; is a variable 'a' of type double. Or even a = []; is also type double, but with empty contents.

8 years ago | 1

Answered
How to create one colorbar for the colors of two pictures?
doc caxis

8 years ago | 0

| accepted

Answered
How to get information about toggle state of checkboxes in GUI?
You can fix that error by locating the checkbox in GUIDE, opening the Property Inspector for it and finding the 'CreateFcn' fiel...

8 years ago | 0

Answered
How do I add 1 arrays elements into another array
a = [b c];

8 years ago | 1

Answered
Function in class not working which normally works
Class functions must take the object of the class as their first argument unless they are static. You are missing this. ...

8 years ago | 1

| accepted

Answered
how to use string within a line of code
handles.( [ 'Num', num2str( button ) ] ) should work, although quite what you are doing with Button I can't work out f...

8 years ago | 0

| accepted

Answered
What does mean(s(:)) do and the reason for using " : " for mean of a square matrix?
(:) reshapes the array to a column vector, as described in doc colon This is done when taking the mean of a 2d image as ...

8 years ago | 1

Answered
How can I troubleshoot error in MATLAB with GCO?
"If this problem is reproducible, please submit a Service Request via: http://www.mathworks.com/support/contact_us/ A technic...

8 years ago | 0

| accepted

Answered
How to stop a for loop after the last 2 values of a 1d array are equal?
idx = find( diff( X ) == 0, 1 ); will tell you the location at which two values are equal. Then just loop as you normally ...

8 years ago | 1

| accepted

Answered
Is there any possible way of writing the following two-line code in one single line?
In a general case, no, you cannot index the result of a function call on a single line. This particular function just happens t...

8 years ago | 1

| accepted

Answered
How to access gscatter property and update data?
h = gscatter(...) gives you an array of 'Line' objects, which you can edit the properties of, including 'XData' and 'YData'...

8 years ago | 1

| accepted

Answered
Plotting the magnitude of the sum of complex exponentials
If you are using degrees you need to use doc cosd not 'cos', which expects radians as input. This is likely why you hav...

8 years ago | 0

| accepted

Solved


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

8 years ago

Solved


Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

8 years ago

Solved


Function Iterator
Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

8 years ago

Solved


Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

8 years ago

Solved


Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

8 years ago

Solved


Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

8 years ago

Solved


Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

8 years ago

Answered
How to restrict a background from changing?
Plot functions and hold and all other similar functions take an axes handle as their first argument. Use it! So many people se...

8 years ago | 0

Load more