Community Profile

# Rik

##### Last seen: Today
1 649 total contributions since 2017

E-mails with feedback/questions about FEX submissions are welcomed. In general I will post e-mails about Answers on the related page, unless there is good cause not to do so.

View details...

Contributions in
View by

how to assign certain range of pixel values with desired color for classification of image?
What you need to do is replicate your grayscale image to three channels to make it an RGB image. Then you can modify the the col...

en dag ago | 1

clustering nearest 5 elements of a data
You can loop through the points in core, calculate the distance for all points, sort those and mark the closest 5.

2 dagar ago | 0

Add a box with error metrics in plot
You can add information to a plot with an annotation, or you can use the rectangle and text functions. The code below will read ...

4 dagar ago | 0

| accepted

Run cmd command from MATLAB
You should not set the PATH, but you should use cd instead to change the directory inside your system call. I personally pre...

5 dagar ago | 0

remove zeros from a 15x300 matrix and find the median
You can use this inside your loop. AS_V(i)= median(AS(AS~=0));

6 dagar ago | 0

Generate row vectors that match indexes
The code below will sample points over a parabola, since three points fully determine a second order polynomial. The middle poin...

11 dagar ago | 0

| accepted

How can I count the number of times a value occurs
You can use bwlabeln to label all your non-zero regions. then you can loop through each of the labeled regions to determine whic...

11 dagar ago | 0

| accepted

How to set value in a matrix
This was a fun puzzle. I believe the code below is one of the many possible solutions. It does use implicit expansion, so for pr...

12 dagar ago | 3

Why the line is not shown in the graph?
You are not indexing the trans variable inside your loop, which results in you overwriting the value every loop iteration. That ...

12 dagar ago | 0

how to plot smooth line plot?
The code below generates some example data and then interpolates the data in the loglog domain. %generate some example data X=...

12 dagar ago | 0

You are reusing i as a loop index multiple times. The mlint also warns you about that. It is a good idea to resolve all warnings...

12 dagar ago | 0

| accepted

How to close the figure contain the uifigure after the alert is closed?
The figure you specify does not actually contain the alert. The function only requires an input to determine where the alert box...

12 dagar ago | 1

| accepted

Adjust intervals of x-axis in the plot!
You can directly set the tick locations with the xticks function. Since your variable is already a datetime (and not datenum), y...

13 dagar ago | 1

| accepted

Vector averaging with mean command
A faster method than a for-loop is using movmean and throwing out the results you don't need. This will also take care of the ca...

14 dagar ago | 1

Submitted

isnetavl
Check for an internet connection by pinging one of Google's DNSes

Does matlab have any function that can compare multiple numbers and return logical value zero or one?
Another of the many strategies: count the number of elements a unique() call gives you. (when I'm back at a computer I'll test t...

16 dagar ago | 0

how to plot roc curve.....
Given your data, this is the ROC curve. In general the code below is added, but that is optional. hold on, plot([0 1],[0 1]...

16 dagar ago | 0

| accepted

While loop - Factorial
You need to repeat the exact same code until some condition is true. The easiest way to do that is with a while loop: n=-1;%set...

17 dagar ago | 0

create a input dialog with text entry and also drop down menu
The easiest is probably to create a tiny GUI. More general tips can be found here, but the basic idea is something like the code...

17 dagar ago | 1

Is there an error in the code?
You haven't converted the number to a date yet and you had a typo in your variable name. Also, 1998/01/01 was a Thursday. Day =...

17 dagar ago | 0

Close a figure when a button is pressed or when a certain elapses
You can set 'close(gcbf)' as the callback of your button, and you could use a timer object to trigger a close as well.

17 dagar ago | 0

| accepted

How to create a GUI
Partly inspired by Adam's comment, I created a class wrapping a GUI as an answer to this question. This example contains a radio...

18 dagar ago | 0

Pass input data obtained from GUI to .m
I think it makes more sense to wrap this GUI in a class, so the class object remains after closing the GUI, which would allow yo...

18 dagar ago | 0

| accepted

How to skip text lines in a .dat file
When the automatic tools fail, it is generally the easiest to fall back to doing it yourself: Read the file as text (e.g. with ...

18 dagar ago | 0

Error using  '  during Transpose 3D variable from .nc file (error: "Transpose on ND array is not defined. Use PERMUTE instead.")
I suspect you don't want to interpolate, but you just want to flip the first two dimensions. In that case you can just listen to...

19 dagar ago | 0

| accepted

Fill box plots with different colors
It looks like g is just a sorted copy of month and x is DIC sorted by month, so why not avoid the numbered variables and use the...

20 dagar ago | 0

| accepted

"Undefined function for input arguments of type 'char'" but the function is designed to take chars.
Generally the errors for functions that you have written yourself will not be this descriptive, unless you make them this descpr...

24 dagar ago | 0

| accepted