Community Profile

Adam


1,636 total contributions since 2014

Professional Interests: Signal Processing, OOP, Matlab GUI programming

Adam's Badges

  • 36 Month Streak
  • Thankful Level 2
  • Guiding Light
  • Revival Level 1
  • Knowledgeable Level 4
  • First Answer

View details...

See 1 Cody Badge

Contributions in
View by

Answered
For loop ranging from negative to positive integers?
Just create an array of e.g. inputVals = -12:20; Then use indices in your loop: for i = 1:numel( inputVals ) A...

3 days ago | 0

Answered
How can I make mlint return all the variable names in my .m-file?
You should just be able to use e.g. ismember( 'Energy', T.Properties.VariableNames ) ismember( 'Power', T.Properties.Var...

3 days ago | 1

Answered
The variable in a parfor cannot be classified, parfor
Something similar to this should work (it gives no M-Lint warnings at least) num_col = 1000; days_simulation = 400; S...

4 days ago | 0

| accepted

Answered
I want a MATLAB code that will resize a given image into 25x25 image using multiple images from a folder
If you have the Image Processing Toolbox then doc imresize should work fine. Use a loop if you want to do it for 649 im...

1 month ago | 0

Answered
imagesc: how to set NaN as white color
doc colourmap allows you to define whatever colourmap you want. You can tag a white point on the front of e.g. a Parula co...

1 month ago | 0

Answered
how can i make figure longer on the x-axis and y-axis
doc pbaspect doc daspect both affect data plotting aspect ratio, if that is what you are asking, but you didn't really a...

1 month ago | 0

Answered
How to set axis of a plot to correspond to their values.
doc pbaspect doc daspect can be used to control the aspect ratio of the plotting area and the data. Also axis eq...

1 month ago | 0

| accepted

Answered
Assigning multiple variables vectors from a cell array
[a1, a2, a3, a4] = cellArray{:}; It is not advisable generally to do this, but for the record, that syntax should work. Ha...

1 month ago | 1

Answered
How can i find the position of nearest number "x" in a matrix "a"
[~,pos] = min( abs( a - x ) ); nearestNum = a( pos );

1 month ago | 0

Answered
How to plot a given signal but by setting a limit on the X value
doc xlim will change the axis limits someArray(1:200) will allow you to only access the first 200 samples of the ar...

1 month ago | 0

| accepted

Answered
Retrieve constant property from class handle reference
myClass.myProp will give you the constant property, you don't need an instance of it. ref = @myClass is a function ...

1 month ago | 0

Answered
How to round a result to 1 decimal place.
Which version of Matlab do you have? round( data * 10 ) / 10; is a fairly standard alternative.

1 month ago | 1

Answered
ignore spesific values in my plot
x=[-0.13*pi:0.01:0.13*pi]; x = setdiff( x, 0 ); would be one way. Just creating x in the first place without it contain...

1 month ago | 1

| accepted

Answered
Matrix calculation to find the average value
D = A + B + C works fine and is surely obvious?! mean( D ) will then give you the result you want, although your nu...

1 month ago | 0

Answered
How do I make the theta-axis or x-axis change color?
hAxes.XAxis.Color = 'b'; will, for example turn the x axis of an axes handle, hAxes, blue. Obviously you can use an RGB tr...

1 month ago | 0

Answered
Implementing listener and callback, infinite loop
Personally I always use addlistener syntax when adding a listener. I am not familiar with your syntax, but it seems it will sti...

1 month ago | 0

| accepted

Answered
Index exceeds matrix dimensions error after code finishes
Use strcmp, not == when testing equality of strings. e.g. if strcmp( Code( counter ), 'Y' ) ... end

1 month ago | 0

Answered
Search specific numbers in column
badRowIdx = find( results( :,6 ) == 1 ); results( badRowIdx, : ) = []; should remove these lines.

1 month ago | 0

| accepted

Answered
How to count count number of times change occured
v1 = [0 0 1 1 1 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0]'; v1Delta = [0; diff( v1 )]; v1ChangeCount = v1Delta; v1ChangeCount( v...

2 months ago | 1

Answered
How to extract RGB values of each pixel from an image?
r = im(:,:,1); g = im(:,:,2); b = im(:,:,3); assuming img is an RGB image of n*m*3 size, for any n, m

2 months ago | 0

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 ...

2 months 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...

2 months 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...

2 months 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...

3 months 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...

3 months 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...

3 months 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...

3 months ago | 1

| accepted

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

3 months ago | 1

| 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.

3 months ago | 0

| accepted

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

3 months ago | 0

Load more