Answered
Why is the inputParser method addParamValue not recommended and how does it differ from addParameter?
addParameterValue is a function from R2007b, addParameter was added in R2013b clearly with the intention of replacing it. So ...

9 years ago | 0

Answered
How can I select a radio button?
Why would the user need to push it again? Do you have functionality under the radio button that triggers when they press it? I...

9 years ago | 0

Answered
How to use AND in an if loop to find the first repeated value
for j = 1:length( allowed_energies ) idx = find( value(:,3) == allowed_energies(j), 1 ); result = value( idx, 6 ) ...

9 years ago | 0

| accepted

Answered
How do I get an extra attempt to activate my Matlab using activation key, given I screwed up the first time?
If you are on windows you should just be able to type 'Activate' in the main search box and one of the options that should show ...

9 years ago | 0

| accepted

Answered
How to create a parameter panel in matlab figure?
doc uipanel contains an example. doc uicontrol gives more examples for the actual controls themselves. Or if you...

9 years ago | 0

Answered
Variable Strings in popup menu
Yes, just set the popupmenu string programmatically. Doesn't matter if you are in GUIDE or not, you can still set the popupmenu...

9 years ago | 0

Solved


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

9 years ago

Solved


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

9 years ago

Solved


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

9 years ago

Solved


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

9 years ago

Answered
i want add a value to every element that is less than zero in my vector.
myVec( myVec < 0 ) = myVec( myVec < 0 ) + 180;

9 years ago | 0

| accepted

Answered
Copy an axes from a figure to an axes in a gui
doc copyobj is what you will likely have to use. I have never used it myself so I don't know what kind of limitations it h...

9 years ago | 0

Answered
Simply entering the debugger during execution of MATLAB GUI fixes error that persists during normal execution
Have you tried inserting a short pause instruction e.g. pause( 0.5 ) between plotting and setting the figure f to be act...

9 years ago | 0

| accepted

Answered
Updating a figure in a GUI pops up a new figure, what's wrong?
'candle' looks like a very old function and does not seem to have a version that allows you to plot on a specified axes, but plo...

9 years ago | 0

Answered
Why should one use class and enumeration instead of structures? and what effect MATLAB will result after using class and enumeration?
I always use classes over structures as they are a lot more different in Matlab than e.g. C++. A struct is just a christmas t...

9 years ago | 1

| accepted

Answered
norm calculation using for loop
n = norm( x ); does it without a loop. There is no reason to do it with a loop. Even if you don't use norm you would stil...

9 years ago | 1

| accepted

Answered
How to plot cell array data?
cellfun( @(x) scatter3( x(:,1), x(:,2), x(:,3) ), RSD_c ) should work, though I haven't double-checked the syntax in Matlab...

9 years ago | 0

Answered
How to decompose Structure into its constituent variables from GUI?
If you saved the variables as individual variables and you just load them as: load( 'someFile.mat' ) then you will get a...

9 years ago | 0

Answered
Matlab, can you create a separate font size for the x tick mark label and y tick mark label?
If you are using R2015b or later you can do the following: hAxes.XAxis.FontSize = 12; hAxes.YAxis.FontSize = 20; for ...

9 years ago | 2

| accepted

Answered
problem with enumeration class
You have to create an object of an enumeration class by defining the enumeration e.g. myEnumObj = classenum.Feb; As far ...

9 years ago | 0

| accepted

Answered
Confusion regarding the range of gray levels possible in Matlab
What code are you using to produce these? I assume just an imshow? The fact that the range for double is 0-1 is exactly why ...

9 years ago | 0

| accepted

Answered
find the number of seconds between two times
date(1) cannot contain a full string. If date is that string then date(1) is just '1'. Alternatively if date is a cell array y...

9 years ago | 0

Answered
How to read specific value from a text file?
fscanf( fid, '%f', [1 1] ) will do the job if you just want the first value.

9 years ago | 0

| accepted

Answered
auto resize static text in GUI
There is a 'FontUnits' property which needs to be set to 'normalized' for this to work. I seem to remember I abandoned this b...

9 years ago | 0

Answered
Msgbox pop up behind GUI
Move it into the Output_Fcn instead. In the OpeningFcn it gets created before the GUI creation is completed so when that GUI ...

9 years ago | 1

| accepted

Answered
Running the matlab class example
t = Testpoint; % Create the object t.expectedResult = 7; % Set the property t.expectedResult % Get the property for e...

9 years ago | 0

| accepted

Answered
How to find the index in array?
Left_A = find( A == 1, 1 ); Right_A = find( A == 1, 1, 'last' );

9 years ago | 0

| accepted

Answered
Calculate the percentage of zeros and ones each row of matrix
percentOnes = sum( myMatrix, 2 ) / 3 * 100; percentZeros = 100 - percentOnes; That is, assuming what you mean by 'I want...

9 years ago | 0

| accepted

Answered
Efficient calculation of 3d matrix of distances
[x, y, z] = meshgrid( (j-jp)^2, (i-ip)^2, (k-kp)^2 ); distSq = x + y + z; MDistances = sqrt( distSq ); should give th...

9 years ago | 0

| accepted

Answered
How to save a new modified colormap ?
filename = 'C:\Me\colourmaps\myColourmap.mat'; save( filename, 'mycmap' ); Obviously filename is whatever you choose it ...

9 years ago | 0

Load more