Answered
Extracton of rows in a matrix based on a specific column value
mat = rand(10,3); res = mat( mat(:,3) <= 0.5, : );

9 years ago | 0

Answered
Function that deletes a row in a matrix
mat = rand(3); n = 2; mat(2,:) = [];

9 years ago | 0

| accepted

Answered
I am trying to use range on xlsread function, but it appears I am on basic mode, how can I change this?
From the help: "If your computer does not have Excel for Windows®, xlsread automatically operates in basic import mode" I ass...

9 years ago | 0

Answered
How to change the linewidth of a curve in a graph by using code?
Well, you haven't plotted anything with that code, but assuming you do: hLine = plot( x, y ); hLine.LineWidth = 2; %...

9 years ago | 0

Answered
Changing class properties with callback function
Derive your class from handle is the easiest way: classdef C_MinFigureControl < handle This brings in a few differences ...

9 years ago | 0

| accepted

Answered
Previous Releases of MATLAB
Go to 'My Account' from the top right of Mathworks website and click the download symbol next to your license. You should get t...

9 years ago | 0

Answered
While loop constraint has to be true for every variable
s=s(i)+1; Is going to overwrite s. Surely you want s(i) = s(i) + 1 instead. This line Results(end+1,:) = [...

9 years ago | 0

Answered
First value of possible empty array
if isempty(A) works just as well as if isempty(A) == 0 which is redundant. If your array is empty though then yo...

9 years ago | 0

Answered
Static variables in MATLAB
You can use <https://uk.mathworks.com/help/matlab/ref/persistent.html persistent> variables if that is what you mean, but only u...

9 years ago | 1

Answered
if statement inside a for loop not working
The representation of the results of floating point maths is not 100% accurate so you should never do a straight == between a nu...

9 years ago | 0

| accepted

Answered
How can I make an array with a function that defines every element?
You don't need a function, just 1 ./ theta_i will do

9 years ago | 1

Answered
Mean of neighbor pixel
If you are finding all 8 neighbours then it doesn't make a difference which is x,y and rows, columns, but your confusion and tha...

9 years ago | 0

Answered
Why does the 3D plot viewer skew as I rotate the point of view?
There is a right-click option when you are in Rotate mode: Rotate Options -> Fixed Aspect Ratio Axes. axis( hAxes, 'vis3d'...

9 years ago | 0

Answered
Error: Subscript indices must either be real positive integers or logicals.
a = [ 1, 2, -1, 1, 2, 3]; x(a,f) = a.*cos(2*pi*f*t); a contains a negative number which is not a legal index into th...

9 years ago | 0

Answered
Is Clearing Redundant Cells Necessary
What do you mean by a sub-script? Scripts use the base workspace so if you call one script from another (which I assume is what...

9 years ago | 0

Answered
Can i use int8 and double in equation and get double as answer?
Cast t to double i.e. double(t)

9 years ago | 1

| accepted

Answered
how i can use multiple axes in GUI ,to set different plots to different axes at a same time ?
The plot function has an overload that takes the axes handle as first argument. You should always use this to plot to an explic...

9 years ago | 0

Answered
Apply different Functions on same data using GPU simultaneously
The GPU is not well optimised for running different functions on data in parallel as far as I am aware so that wouldn't be faste...

9 years ago | 0

Answered
selecting a smaller array from a bigger one
result = r(21:60, 21:70, 31:50 ); I'm not sure I see what the problem is?

9 years ago | 0

| accepted

Answered
Label more than 7 lines in a plot
You can set your own colours for lines you plot and you can also specify the colours used on an axes by setting the ColorOrd...

9 years ago | 0

Answered
Find match for a pair of rows in cell arrays
[C, ia, ic] = unique( alfa ); should give you this information. The C vector gives the characters and the ic vector tells ...

9 years ago | 0

Answered
Array values not corresponding to condition
You are doing your changes in-place and in sequence, so those that were caught by the 1st condition get changed to 1 and then al...

9 years ago | 0

Answered
I can detect fire in a pic but ı can not give 'fire alarm' by using 'if' and 'msgbox', How can ı give fire alarm with my codes below.
R=img_ycbcr(:,:,1); returns a 2d matrix. R==0 will never return true for this. If you want to check that all values are 0 t...

9 years ago | 1

Answered
How can I set a colorbar for single values corresponding to multiple polygons created with geoshape?
Do you mean you want every polygon to be a different colour? And is it then impossible for two polygons to have the same sample...

9 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
Not so much a wish, just an oddity I noticed. I set my profile to not allow me to be contactable by e-mail etc and I deselect t...

9 years ago | 1

Answered
How to check if right axis is visible?
function isVisible = isYAxisVisibleAtLocation( hAxes, location ) assert( isgraphics( gca, 'axes' ) ); location = val...

9 years ago | 1

Answered
why haart2 function isn't found in matlab ?
So far as I can see the function in the Wavelet Toolbox is named haart so I'm not sure what your haar function is, but i...

9 years ago | 0

Answered
Change 1 to -1 in a matrix
m = ones(4); r = rand(4) - 0.5; m = m .* sign( r ); is one of many ways to do it.

9 years ago | 1

| accepted

Answered
Putting 1 around the matrix
a = zeros(3); b = padarray( a, [1 1], 1 ); would put 1s all the way round, but this produces a 5x5 matrix. A 4x4 matrix...

9 years ago | 0

Answered
ROI tool with multiple objects (imrect, imellipse and impoly): obtaining position data for each object
Use a function instead of a script, have a variable in your main function representing the position and update this in your call...

9 years ago | 0

| accepted

Load more