Community Profile

photo

Rik


1,165 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.

Contact

Rik's Badges

  • 12 Month Streak
  • Revival Level 3
  • Guiding Light
  • Thankful Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
How to write txt file contain double array and text header?
You can use repmat or sprintf to construct the FormatSpec. array=rand(3000,48); fid=fopen('test.txt','wt');%opening with the...

5 hours ago | 0

| accepted

Answered
Cannot load MATLAB file properly
The dataset class is part of the Statistics (and Machine Learning) Toolbox according to the doc. So you will either need to re-i...

7 hours ago | 1

Answered
Plot frequency along the y-axis without using a histogram
Please don't delete a question because you're not getting the feedback you want. Since you didn't provide any example data, I'l...

1 day ago | 0

Answered
Tracking the size of a variable
Yes. Set a break-point at the beginning of your function and go through your code step by step.

3 days ago | 0

Answered
Finding the closest neighbouring coordinates in 3D
As suggested here, if you have the statistics toolbox, you can use the pdist function. If you have more structured data (e.g. a ...

3 days ago | 0

| accepted

Answered
find the minimum RGB values of a pixel from an image
You mean like this? RGB=uint8(255*rand(100,100,3));%random RGB image temp_IM=sum(double(RGB),3);%sum the three color channel...

4 days ago | 1

Answered
Calling nonlinear constraints before objective function
You could let your objective function return inf when invalid parameters are provided. Then any minimizer will avoid values resu...

4 days ago | 1

| accepted

Answered
v(t) is not defined help me!
This code should work: m=70; g=10; c=10; t=0; v=0;n=0; while t<7*log(100) t=t+0.1; n=n+1; v(n+1)= v(n)+0.1*...

5 days ago | 0

Answered
retrieve binary data back
In case you wanted to accept my answer, I'll repost my code in an actual answer. However, I would suggest you use Madhan's solut...

5 days ago | 2

| accepted

Answered
i created function works on 3*3 matrix how i make it work on 9*9 mat with loop?
This should work better: function tf=checkunit(a,tol) %Check matrix for unique values %This function returns true when no dup...

6 days ago | 0

Answered
replace duplicate entry in columns
I expect this code does what you want. The order in which the array is processed matters, so you need to make sure that this sat...

6 days ago | 0

| accepted

Answered
how to display / recall data in matlab
As long as the input array A has sufficiently unique values, you can use either ismember or ismembertol. A=[10 20 30 40 50] bl...

7 days ago | 0

Answered
Flow of information in callback functions
You can find some more information in the documentation. The @ creates a function handle. There are two options here: an anonym...

7 days ago | 0

| accepted

Answered
Circle interpolation (calculate the values inside)
If you want to fill a circular area with a particular color, you can use this code: center=[10,20];%xy coordinates of the cente...

8 days ago | 0

| accepted

Answered
Why can't i plot a graph for a against t?
Here are some variations you could try: k_n= 7*10^-11; n= 2; i=1; dt=1/3600; %1sec interval t=zeros(1,floor(2.5/dt)); %in h...

8 days ago | 2

Answered
How to loop over a series of files
Your mistake was numbering your variables. However, you can use eval to solve your current problem. You should avoid eval. Make...

9 days ago | 0

Answered
Running average using for loops
I guess boldly: If you want a sliding window average, you can use a convolution: data=magic(8);data=data(:);%generate some dat...

10 days ago | 2

| accepted

Answered
how to modify contrast in multiple dicom images using slider GUIDE
You can use the callback of the slider to adjust the caxis. In my FEX submission WindowLevel I do something similar, but with d...

10 days ago | 0

| accepted

Answered
Excel and MATLAB connection
You can use xlsread to read data from Excel in your code. I would avoid the use of ActiveX whenever you can avoid it. You can fi...

10 days ago | 1

Answered
Average of a single element in an array
The best method depends on how you have generated your array. I will show two examples below. %example 1: only integers A=rand...

10 days ago | 1

| accepted

Answered
How can I rotate the lines on an image
You can use code similar to that below. I changed the step size to 30 degrees to make it more clear what is happening. clc cen...

11 days ago | 0

Answered
how to sum of each row according to values values in given function
You can do something like the code below. You could use a for loop instead of the call to cellfun, but as you can see, you don't...

11 days ago | 2

| accepted

Answered
how to estimate bright channel for color image in Matlab??
Below you find 2.5 strategies. The first should be a lot faster, especially for larger images. With the last it is easier to see...

11 days ago | 0

Answered
Please advise me on how to improve the efficiency of this code?
You could use an explicit dialog box to avoid any confusion: answer = questdlg(... 'Do you want to try again?', ...%questi...

11 days ago | 0

Answered
Working with dicom images
You need to convert to either a double or a int16 (before applying the subtraction). The latter only has a maximum half as high ...

11 days ago | 0

| accepted

Answered
Using a While loop to determine number greater than a constant
I'm a bit hesitant to provide you with a complete working solution, since you mention it is homework. I will give you some advic...

12 days ago | 0

Answered
Why reading in csv files will not work for me.
Why aren't you trying something like this? files = dir('*.csv') Q = numel(files); data=cell(Q,1); for n=1:Q % Read in C...

12 days ago | 0

Answered
distributing two values in 3d array
You could also do the following: L=60; % Number of columns b=25; % Number of rows w=25; %the depth of the 3D lattice K_f1=5e...

12 days ago | 1

Answered
make cell and put number on it
You can do it like this: n=20; result=num2cell(1:n);

12 days ago | 0

| accepted

Answered
reducing resolution of an image
You can use the imresize function to resample images: A=uint8(randi(255,1666,1200,3));%generate random 2MP image dims=size(A);...

12 days ago | 0

| accepted

Load more