Answered
Listbox and Pushbutton in GUI
You should never call one uicontrol's callback from inside another one and certainly not passing down the hObject of the first o...

9 years ago | 1

| accepted

Answered
Subtracting two matrices of different size element by element
A(1:690) - B; will work without giving you errors, but quite why you would be in a situation where you want to subtract vec...

9 years ago | 0

| accepted

Answered
How to store values in a vector?
Vet = [5 9 repmat( [1+3, 3+4, 5+6], [1 3] )] will give you that specific vector. For a more general case it depends what y...

9 years ago | 0

Answered
Filter a struct based on the field name.
names = fieldnames( myStruct ); subStr = 'f1_'; filteredStruct = rmfield( myStruct, names( find( cellfun( @isempty, strf...

9 years ago | 1

| accepted

Answered
Index exceeds matrix dimensions. Error in GUI
Are you actually passing the data into the subGUI when you launch it? e.g. subGUI( data );

9 years ago | 0

Solved


Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

9 years ago

Solved


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

9 years ago

Answered
How to use the string of a variable as a new variable name?
Why would you ever need the name of a variable to change during an iteration? A variable name is just a handle to the variable,...

9 years ago | 1

Answered
How to take the X smaller values of an array ?
[y,idx] = sort( x ); [~,idx2] = sort( idx(1:6) ); y = y( idx2 ); There may be a slightly more elegant way, but that d...

9 years ago | 1

| accepted

Answered
Passing the input argument to the class
If your class constructor takes arguments then just [a, b, c] = getdata( datalength, stringlength ); myObj = myClass( a,...

9 years ago | 0

| accepted

Answered
Cell contents assignment to a non-cell array object
main is declared as a struct so yes, you would get that error if you are trying to assign to it as though it is a cell array whi...

9 years ago | 0

Answered
Meaning of ~isempty()
~ means NOT so *isempty* tells you if the vector is empty and *~isempty* tells you if the vector is _not_ empty.

9 years ago | 11

| accepted

Answered
how to load a file from different folder than our m. file?
Use the following syntax [FileName,PathName,~] = uigetfile(FilterSpec) then filename = fullfile( PathName, FileName...

9 years ago | 0

| accepted

Answered
Indices of a maximum value in a multidimensional matrix.
[maxVal, idx] = max( myMatrix(:) ); [x, y, z, w] = ind2sub( size( myMatrix ), idx );

9 years ago | 0

Answered
How can i connect different points using straight line after plotting? is there any plotting tool?
How did you plot your points? The plot or line functions will, by default join points with a line.

9 years ago | 0

Answered
Hardcoded Integers in C code generated by Matlab Coder
I would imagine they are 'epsilon' type parameters that are there to catch situations where you would end up dividing by zero or...

10 years ago | 0

Answered
Parfor possible, though iterations depend
k is not involved in your parfor loop at all so each worker will just create its own List variable and doesn't care about the fa...

10 years ago | 1

Answered
How to get an output from a callback function?
If you want to get into using object-oriented programming you can do something like this: Define a class derived from handle ...

10 years ago | 0

Answered
About the Number property of figure function
'Number' is a read-only property. You can call: hFig = figure( 3 ); set( hFig, 'Position', [9 39 900 300], 'Name', 'Velo...

10 years ago | 2

| accepted

Answered
subscript indices must either be real positive integers or logicals( X_re(k_r)=XD(1,kd); can anyone help me why i am getting this error
At a glance N/d is 1024 / 28 which is not an integer so I imagine k_1=[k_1,kd+(hhh-1)*N/d]; produces non-integer values ...

10 years ago | 0

Answered
Why is graphics object not being passed by reference in nested functions? (gobjects array loses values when function closes)
The array of GraphicsPlaceholder objects is not passed by reference, it is the objects themselves that would be passed by refere...

10 years ago | 0

| accepted

Answered
Calculate value based on previous row plus adjacent row
For that particular example: B = cumsum( A )';

10 years ago | 0

Answered
Multiple element at same index
Use a cell array if you really want to do this i.e. y = { 0, -4, -2, [0 2 4], 0 }; Be aware though that using cell array...

10 years ago | 0

Answered
Clear all workspace except variables use in GUI
Why don't you just use a function instead of a script? GUIs and scripts are not a great mix in general. Also, this is one of...

10 years ago | 0

| accepted

Answered
Axis equal plot in multiple axes GUI
The documentation for the axis equal command states that the following axes properties change: 'Sets DataAspectRatio ...

10 years ago | 0

Answered
Radio button to ON-OFF figure visibility
Right click on your radio button group panel (you should put radio buttons in a button panel if they aren't already) and select ...

10 years ago | 0

Answered
linkdata to structured data
You can set the 'XDataSource' and 'YDataSource' of the line object to e.g myStruct.a and myStruct.b (never call a struct 'struct...

10 years ago | 0

| accepted

Answered
Quantizing a grayscale image into 256 levels
In your case, assuming the values are still in the desired [0 255] range then just rounding and/or casting to integers is the be...

10 years ago | 0

Answered
Given the variables how can i repeat a formula multiple times
For a start, lose the variables a_1, a_2, etc. Use an array, a, of all of them. Likewise with b and the same with the result i...

10 years ago | 0

Answered
MATLAB Inconsistency in calculating mean of time series from 2 different methods
Your first approach appears incorrect to me. You can only do that if there are the same number of values in each segment becaus...

10 years ago | 0

| accepted

Load more