Community Profile

photo

Rik


1,237 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 create a for/ while loop until a condition is met
You can use the min function to enforce a maximum outcome. max_cost_allowed=14; cost=min(cost,max_cost_allowed); As a more ge...

14 hours ago | 0

| accepted

Answered
MEAN OF IMAGE IN MATLAB
If your list of images is a 0x1 struct, then the files are not found. Once you solve that issue, you can use the code below to f...

17 hours ago | 0

Answered
how to generate a vector of zeros with 2 random successives cell containing ones
If you don't mean cell, but element: n=10;%vector length v=zeros(1,n); one_ind=randi(n-1,1); v(one_ind+[0 1])=1; If you do ...

18 hours ago | 0

Answered
Creating Table From Excel Data
A dot can mean two things: accessing a field of a struct or a variable in a table calling a method in a class, e.g. in the syn...

18 hours ago | 0

Answered
How do I get rid of this error. Error using monte_carlo_error (line 42) 'normrnd' requires Statistics and Machine Learning Toolbox."
The Statistics and Machine Learning Toolbox is included in the student suite (which is a product you can buy with a student lice...

21 hours ago | 0

Answered
normally distributed demand data
You can use the randn function to generate random numbers. n=300;%number of cases minval=0;%lowest allowed integer maxval=100...

22 hours ago | 0

Answered
calculating Kernel density for each column
I am assuming the v values are the same as the column index, and that you made a mistake with the code for the second column. Z...

22 hours ago | 0

| accepted

Answered
Difference Between ValueChangedFcn & ValueChangingFcn
If you read the documentation carefully, you will notice a subtle difference. This difference is more easily explained with a ui...

24 hours ago | 0

| accepted

Answered
How to pass image from one push button to another ?
Save it to the guidata struct.

1 day ago | 0

| accepted

Answered
can I run the matlab code file made in old days in recent version of matlab
Some function have been removed, some syntaxes have changed. Most of Matlab is backwards compatible, but not 100% is. The more c...

2 days ago | 0

Answered
Share data between gui
Pass a handle to the second gui when calling gui 3 and 5. Then you can use guidata to load the data from gui2 in gui5.

2 days ago | 0

Answered
While conditioning to any element of an array
You need to make sure you have a scalar condition, instead of having an array. The any and all functions are very useful in case...

4 days ago | 0

| accepted

Answered
i need to convert a folder of 200 .jpg images to .mat (to create 200 separate .mat files). i know there should be an easy matlab for loop to do this but I need help (newbie). thanks!
You're quite close. You were only missing the way to generate char arrays from a pattern. To do that you can use the sprintf fun...

4 days ago | 1

Answered
import XLSX FILE and plot it in guide
Now I realize what was the strange thing about your code: they are char arrays instead of function handles. In principle that is...

6 days ago | 0

Answered
Rebuild the matrix according to the values of its elements
Edit: Now I think I get it. That is also where your precision remark is coming from. The code below gets the job done with isme...

7 days ago | 0

Answered
For loop count question
Initialize count to 0 before your nested loop and do count=count+1; inside the inner loop.

7 days ago | 0

Answered
How do I write a Roulette Code?
n_games=100; your_number_pick=34; Red=[1:2:9 12:2:18 19:2:27 30:2:36]; Black=[2:2:10 11:2:17 20:2:28 29:2:35]; roulette_...

9 days ago | 0

Answered
"at most" in MATLAB
This code should help: check =[1 4;2 5;3 6]; %i=2;j=3; i=5;j=3; matches_per_col=sum(check==i | check==j,1); if max(matches_...

9 days ago | 1

| accepted

Answered
how to delete the previous plot obtained using slider in GUIDE
The easiest way to accomplish this is to create the second plot first, using the same positions as the first plot (which will th...

10 days ago | 0

Answered
How can i make my code interactive?
You aren't checking if the values are valid. That means you're never changing the value of valid, which results in an endless lo...

10 days ago | 0

| accepted

Answered
How do I separate a string with hyphen and colon separation within cell
If you know the pattern you can simply use that to edit the FormatSpec: fileID=fopen('RD-180531-160600.txt'); FormatSpec='%4s-...

10 days ago | 0

| accepted

Answered
Justify text in MATLAB Live Editor
Yes, the buttons to allign text are in the lint:

10 days ago | 0

Answered
iam getting error while iam debugging the code in matlab 2019, But it is excuting in matlab 2014 version.... Iwant this in MATLAB 2019 please help me
There are only two relevant lines from your enormous blocks of code (that you didn't format yourself): %initial post: h_16qam=...

10 days ago | 0

| accepted

Answered
Replace matched values with a cell array keeping unmatched values unchanged
This code should help A = '[0, 40, 50, 60, 80, 100, 140, 160, 200, 300]'; B = '48 43 533 6320 ...

10 days ago | 1

| accepted

Answered
How to campare index number of a matrix with other
A=[ 9 8 5 4 4 10]; B=[1 1 1 3 3 3 2 2 1 1]; newA=B(A);

10 days ago | 1

Answered
How can I multiply axis values by 1000 without changing the data?
You can either multiply the y-values with 1000, or use the YTickLabels: ticks=get(gca,'YTicks');%retrieve current ticks ticks=...

13 days ago | 0

Answered
regexp for time - cannot guess it
If you know this format, maybe a regexp isn't the right tool for the job. function s=parse_time(str) c=regexp(str,'\.','split'...

14 days ago | 0

Answered
read empty line by textscan
If your file doesn't contain any special characters, you could try fileread (which reads a file as one long char array), then sp...

15 days ago | 2

| accepted

Answered
Subtraction of 2 matrices of the same dimensions and values, gives large floating point values instead of 0!
Welcome to the world of floating point calculation. Computers store values in binary, which sometimes requires rounding. This ro...

15 days ago | 1

| accepted

Answered
How to find the local mean of an image?
The fastest way to get a local average is to do a convolution with a flat structuring element: %load example image A=imread(['...

16 days ago | 0

| accepted

Load more