# Rik

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.

**Statistics**

RANK**23**

of 239.739

REPUTATION**7.274**

CONTRIBUTIONS

**12** Questions

**2.521** Answers

ANSWER ACCEPTANCE **
33.33%
**

VOTES RECEIVED**1.026**

RANK**2.323** of 16.832

REPUTATION**667**

AVERAGE RATING**4.80**

CONTRIBUTIONS**28** Files

DOWNLOADS **138**

ALL TIME DOWNLOADS**4203**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Error finding Linear Regression with polyfit and \

Removing the NaNs will do the trick. Although I'm not sure this data should have a linear fit. fn=websave('data.mat','https://w...

etwa 4 Stunden ago | 0

textscan - multiple format lines

It looks like the same format to me. Why not read as text, split on the = and use str2double on the last column? To read your f...

etwa 4 Stunden ago | 0

Create arrays of observations

You should not name your variables dynamically. Why are you not storing them in an array when reading? What is wrong with the co...

etwa 6 Stunden ago | 0

How to count the black pixels in a segmented section of image?

activecontour returns a logical array. That means you can count the black pixels by inverting and using sum (or nnz).

etwa 12 Stunden ago | 0

How to correctly plot a 6x2 grids of subplots

You can also make a montage yourself. The function below is from my unpublished toolbox replacement suite. You still need an i...

etwa 13 Stunden ago | 1

| accepted

Could anyone help me how to generate the matrix in the following manner as described below

data=cell(5,1); for n=1:numel(data) data{n}=randi([1 n],n*100,1); end data=cell2mat(data); size(data)

etwa 15 Stunden ago | 0

Which MATLAB version for standardized GUI tool ?

Which release is the best choice will depend on specifics. As an extreme example: sometimes the performance of Matlab 6.5 (R13) ...

etwa 16 Stunden ago | 0

Matlab integral funtion error

The error tells you that you need to make sure f outputs the same size as the input. f=@(x)(x.*exp((x.^2)-1))./sin(x); % ...

etwa 16 Stunden ago | 1

| accepted

how to create an array of ones with some zeros delimited by an ellipse?

I'm going to ignore the part where you want to plot a cartesian object with polar coordinates. You can either use ndgrid or mes...

ein Tag ago | 0

How to display rise time in edit box MATLAB Gui?

The function you're using doesn't return a single numeric value, but a struct, as the documentation clearly explains. You need t...

ein Tag ago | 0

| accepted

defining properties in a class

This doc page seems to suggest this is not natively possible. However, you could implement it as method: %(untested code) clas...

ein Tag ago | 0

combination from multiple arrays while omitting same item

We have a small problem when we want to generate all combinations: C = nchoosek(v,k) is only practical for situations where len...

ein Tag ago | 0

cswwrite not in one column

This issue is an Excel issue, not a Matlab one. You need to use the 'convert data to columns' option in Excel. You might try t...

2 Tage ago | 0

Using cell array for indexing

I would suggest something like this: IndArray={i1,...,im} for dim=(numel(IndArray)+1):ndims(A) IndArray{dim}=1:size(A,dim...

3 Tage ago | 0

| accepted

Add particular elements of array

Not the tidiest code, but it all happens in a single loop, with cumsum doing the addition prior to the loop. %set your data da...

3 Tage ago | 1

| accepted

Somthing wrong with SOM Toolbox

There isn't actually something wrong with the toolbox (at least with this code snippet). It is just assuming the handle to a col...

4 Tage ago | 0

| accepted

Combination of distances between multiple points

You already have the generalized code. You just need to combine it with nchoosek: x=1+10*rand(1,6); y=1+10*rand(1,6); r=rand(...

6 Tage ago | 0

| accepted

Why do I get ans = logical 1 or 0 in the command window for the following script?

A comma does not mean and. In the Matlab syntax it is used to delimit two statements, so the second part of the line with your i...

6 Tage ago | 1

| accepted

delete elements of a vector wich are not consecutive

You need some tricky indexing, but I believe this is what you need: v=1:(72*6); k=72; ind=(k:(2*k):(numel(v)-k)) + (1:k).'; ...

6 Tage ago | 0

| accepted

Displaying multiple lines in MATLAB GUIDE text edit box

You need to make sure the max property is set to a large enough value, and that the uicontrol type supports multiple lines.

7 Tage ago | 0

Return non-rounded value when assigning variable to index of array

You're confusing the data itself with how it is displayed. It is probably a double, meaning the value you attempted to assign wa...

7 Tage ago | 0

Filtering a table with datatime on dates

There is probably a native way to do this, but you could also do it yourself: ref=datetime(2019,10,1); L=day(ref)==day(tmp.Var...

7 Tage ago | 1

Computational capability difference between Student and Academic Versions

The functions are the same, only the license is different. There is a difference in which exact toolboxes are available for eac...

7 Tage ago | 0

| accepted

Error Unexpected MATLAB expression.

You were missing an equal sign: c1(isinf(c1))=0; c1(isnan(c1))=0; % ^ % this one...

8 Tage ago | 0

How to create new ppt by using Matlab Script ?

If you want to avoid the use of a COM object (and are ok with moving to pptx): There is a submission on the file exchange calle...

8 Tage ago | 0

How to multiply function handles stored in a cell array?

Na=repmat({@(w) [1,-w*i(2,e);0 1]},1,3) sa=@(w) 1; for n=1:numel(Na) sa=@(w) sa(w)*Na{n}(w); end Note that in this case...

9 Tage ago | 0

| accepted

To find Maximum value and minimum value for each group of four rows for a 180*1 matrix

Easy if you reshape the vector to an array: data=rand(180,1); data_=reshape(data,12,[]); max(data_,[],1) min(data_,[],1)

9 Tage ago | 0

Splitapply command and merge results

The question for you is what you mean by merging, but steps 1 to 4 are below. %generate example data B=10*rand(1,100); edge...

9 Tage ago | 0

Two conditional operations can be used in matlab or do I need to use double if?

It looks like you could use a lookup table and skip the entire loop: transversal=[0 1 0 1];longitudinal=[0 0 1 1]; LUT=[2 3;...

9 Tage ago | 0

| accepted

make an interactive graphic?

You can use the ButtonDownFcn property to trigger a function when the user clicks on an axes object. You can use the CurrentPoi...

10 Tage ago | 0