Community Profile

# Rik

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

#### Rik's Badges

View details...

Contributions in
View by

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

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

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

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

4 dagen ago | 0

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

5 dagen 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_...

6 dagen 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_...

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

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

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

8 dagen ago | 0

| accepted

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

8 dagen 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=...

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

8 dagen 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);

8 dagen 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=...

11 dagen 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'...

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

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

13 dagen 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(['...

14 dagen ago | 0

| accepted

Answered
How to calculate the shortest distance between points and a line?
You can use the point_to_line_distance function.

14 dagen ago | 0

| accepted

Answered
Can isstrprop search for 2 properties?
I would convert to double type and use ismember to check if all characters are allowed. Alternatively you could just convert ...

14 dagen ago | 1

Answered
EULER'S METHOD GUI HELP
You are using str2num (which you shouldn't), and you are setting a numeric vector as the string property. You may need to consid...

14 dagen ago | 1

Answered
How do i create checkboxes near each plots in a subplot window ?
You can use uicontrol('Style','checkbox').

15 dagen ago | 0

| accepted

Answered
Matching based on working days
You can use the weekday function. You can easily adapt the function below to apply specific shifts. A=datenum({'2019-04-07','20...

15 dagen ago | 0

| accepted

Answered
Two differente program to write in the same place
This is just a simple concatenation: function output=xx output=[main transfer]; end function output=main output=rand(19,6);...

15 dagen ago | 0

Answered
help with this 02 questions please
For question 1: link For question 2: you can create a CloseRequestFcn that also closes the secondary app link.

15 dagen ago | 0

| accepted

Answered
Memory issue to create 4D array
The amount of data is probably huge, is not pre-allocated and will probably not fit in memory. Have you calculated an estimated ...

15 dagen ago | 0

Answered
Finding pythagoras triples when only c is known
You are quite close. The code below contains some optimization in terms of selection of values to check, and the check is modifi...

16 dagen ago | 1

Answered
how do i read a folder database into matlab
Use uigetdir to ask the user for a folder, then use dir to get the list of files inside that folder, then use a for loop to load...

18 dagen ago | 0

| accepted

Answered
if statement not working
What you probably think should happen is in the code below, however, there is a better way. A = [5;5;5;3;3;2]; B = [10;4;10;10...

18 dagen ago | 1

| accepted

Load more