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.

View details...

Contributions in
View by

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

environ 2 heures ago | 0

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

environ 3 heures ago | 0

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

3 jours ago | 0

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

3 jours ago | 0

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

3 jours ago | 0

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

5 jours ago | 0

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

5 jours ago | 1

| accepted

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

6 jours ago | 0

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

6 jours ago | 0

| accepted

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

6 jours ago | 0

| accepted

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

6 jours ago | 0

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

6 jours ago | 0

| accepted

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

6 jours ago | 1

| accepted

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

6 jours ago | 1

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

10 jours ago | 0

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

10 jours ago | 0

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

11 jours ago | 2

| accepted

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

11 jours ago | 1

| accepted

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

12 jours ago | 0

| accepted

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

12 jours ago | 0

| accepted

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

12 jours ago | 1

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

12 jours ago | 1

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

13 jours ago | 0

| accepted

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

13 jours ago | 0

| accepted

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

14 jours ago | 0

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.

14 jours ago | 0

| accepted

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

14 jours ago | 0

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

14 jours ago | 1

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

16 jours ago | 0

| accepted