Answered

find the row and column value of a specific value in cell array

You need to use a bit of trickery to use find (ismember will not work normally either). cellarr = {... 'a','b','c', 3 ,5;....

find the row and column value of a specific value in cell array

You need to use a bit of trickery to use find (ismember will not work normally either). cellarr = {... 'a','b','c', 3 ,5;....

alrededor de 15 horas ago | 1

| accepted

Answered

Write and format table to csv file

You can use formattedDisplayText (which was introduced in R2021a). (see this highlight for an extra example) For older releases...

Write and format table to csv file

You can use formattedDisplayText (which was introduced in R2021a). (see this highlight for an extra example) For older releases...

alrededor de 18 horas ago | 0

Answered

How do you check if an inputed number is an array/vector or just 1 value?

In my view using numel or isscalar (introduced somewhere between v6.5 and v7.1) would be a better solution. xscalar = numel(x)~...

How do you check if an inputed number is an array/vector or just 1 value?

In my view using numel or isscalar (introduced somewhere between v6.5 and v7.1) would be a better solution. xscalar = numel(x)~...

1 día ago | 0

Answered

Help with if statement in a calculation loop

The problem is that you assume Matlab will process each element of x separately. Matlab will only do that if you use a loop. ...

Help with if statement in a calculation loop

The problem is that you assume Matlab will process each element of x separately. Matlab will only do that if you use a loop. ...

1 día ago | 0

Answered

Can I open a file made in R2019a with different versions of matlab (R2017b)?

This depends on what kind of file you're talking about. mat files and m files are very portable, especially if you leave the def...

Can I open a file made in R2019a with different versions of matlab (R2017b)?

This depends on what kind of file you're talking about. mat files and m files are very portable, especially if you leave the def...

5 días ago | 0

| accepted

Answered

Comparing values of a vector

This is the easiest way to do it vectorized: Zc_0_to_P =@(x) (M/P^2)*(2*P.*x - x.^2); % 0≤x≤P Zc_P_to_1 =@(x) (M/(1-P)^2)*((1-...

Comparing values of a vector

This is the easiest way to do it vectorized: Zc_0_to_P =@(x) (M/P^2)*(2*P.*x - x.^2); % 0≤x≤P Zc_P_to_1 =@(x) (M/(1-P)^2)*((1-...

5 días ago | 0

| accepted

Answered

Version number 2021a Version='9.10' is confusing. Why not using '10.0'

Versioning is a complex and hotly debated topic. Generally you want to increment the first number if you have a really big upgra...

Version number 2021a Version='9.10' is confusing. Why not using '10.0'

Versioning is a complex and hotly debated topic. Generally you want to increment the first number if you have a really big upgra...

6 días ago | 0

| accepted

Answered

Assign date values manually to datetime array matlab

For pre-R2020b, you can use readfile, which you can get readfile from the FEX. If you are using R2017a or later, you can also ge...

Assign date values manually to datetime array matlab

For pre-R2020b, you can use readfile, which you can get readfile from the FEX. If you are using R2017a or later, you can also ge...

6 días ago | 1

| accepted

Answered

courbe de progression du pixel

%load an example image S=load('mri'); I=squeeze(S.D); x=randi(size(I,1));y=randi(size(I,2)); intensity=squeeze(I(x,y,:)); ...

courbe de progression du pixel

%load an example image S=load('mri'); I=squeeze(S.D); x=randi(size(I,1));y=randi(size(I,2)); intensity=squeeze(I(x,y,:)); ...

6 días ago | 0

| accepted

Answered

modify a program to obtain the same result from right to left

Your loop can probably be replaced by a vectorized operation, but I will leave that for you to figure out. I suspect fliplr and ...

modify a program to obtain the same result from right to left

Your loop can probably be replaced by a vectorized operation, but I will leave that for you to figure out. I suspect fliplr and ...

7 días ago | 0

| accepted

Answered

How to use output numbers as a vector.

There are may sorting algorithms you could implement. One of the easiest to implement (and one of the slowest) is called bubble ...

How to use output numbers as a vector.

There are may sorting algorithms you could implement. One of the easiest to implement (and one of the slowest) is called bubble ...

8 días ago | 1

| accepted

Answered

When I attempt to run this it produces an 'error using zeros, size inputs must be integers' for the line DcDt = zeros(n,1). The code is supposed to produce a breakthrough curve. Any help is appreciated.

L is not defined. If it is smaller than 0, this will lead to z being empty, meaning that n is 0. L=-1; z=0:0.001:L; numel(z) ...

When I attempt to run this it produces an 'error using zeros, size inputs must be integers' for the line DcDt = zeros(n,1). The code is supposed to produce a breakthrough curve. Any help is appreciated.

L is not defined. If it is smaller than 0, this will lead to z being empty, meaning that n is 0. L=-1; z=0:0.001:L; numel(z) ...

8 días ago | 0

| accepted

Answered

Evaluating function on an array of values

There are several problems here. The main one is that you are using matrix operations instead of element-wise division. In this ...

Evaluating function on an array of values

There are several problems here. The main one is that you are using matrix operations instead of element-wise division. In this ...

9 días ago | 0

| accepted

Answered

Using student license on more than one computer

Since a student license is a personal license (and only allows installation on 1 computer), there are two problems with your pla...

Using student license on more than one computer

Since a student license is a personal license (and only allows installation on 1 computer), there are two problems with your pla...

12 días ago | 0

Answered

str2num returning value while the preferred str2double returning NaN...

This is another difference: str2double('evalc(''exit'')') str2num('evalc(''exit'')') %will exit Matlab You should parse the ...

str2num returning value while the preferred str2double returning NaN...

This is another difference: str2double('evalc(''exit'')') str2num('evalc(''exit'')') %will exit Matlab You should parse the ...

12 días ago | 0

| accepted

Answered

Is it possible to vectorize this simple recursive function in loop?

Vectorization should only be attempted if there are more direct functions. Otherwise, for loops in Matlab are surprisingly optim...

Is it possible to vectorize this simple recursive function in loop?

Vectorization should only be attempted if there are more direct functions. Otherwise, for loops in Matlab are surprisingly optim...

13 días ago | 3

Answered

Writing data from GUI handles to text file

(the advice I wanted to post became a bit long, so I will put it in an answer instead of a comment) My general advice for writi...

Writing data from GUI handles to text file

(the advice I wanted to post became a bit long, so I will put it in an answer instead of a comment) My general advice for writi...

15 días ago | 1

Answered

How to create legend with multiple variables in a loop ?

You should put the figure creation and the creation of the legend outside the loop. You are merging the two texts, but you sh...

How to create legend with multiple variables in a loop ?

You should put the figure creation and the creation of the legend outside the loop. You are merging the two texts, but you sh...

15 días ago | 0

Answered

Adding a cell to another cell in a specific position

What do you mean exactly by adding? %create some data n=3;m=5; A=num2cell(1:n).'; B=num2cell(2*n+(1:m)).'; %option 1: A1...

Adding a cell to another cell in a specific position

What do you mean exactly by adding? %create some data n=3;m=5; A=num2cell(1:n).'; B=num2cell(2*n+(1:m)).'; %option 1: A1...

16 días ago | 0

| accepted

Answered

remove cell values of a column vector not contained in another column vector

doc ismember And maybe setdiff will do the trick as well.

remove cell values of a column vector not contained in another column vector

doc ismember And maybe setdiff will do the trick as well.

18 días ago | 0

Answered

For loop in a for loop

You are resetting b in your loop, so only the last value of k matters. And the middle loop isn't a loop, as it is a scalar.

For loop in a for loop

You are resetting b in your loop, so only the last value of k matters. And the middle loop isn't a loop, as it is a scalar.

18 días ago | 1

| accepted

Answered

plot all roots of a polynomial which has a interval coefficient

I meant something like this. N=200; Z=NaN(N,3); a=linspace(2,3,N); for n=1:numel(a) p=[1 a(n) 1 1]; z=roots(p); ...

plot all roots of a polynomial which has a interval coefficient

I meant something like this. N=200; Z=NaN(N,3); a=linspace(2,3,N); for n=1:numel(a) p=[1 a(n) 1 1]; z=roots(p); ...

21 días ago | 0

| accepted

Answered

Unable to select seed points manually in region growing algorithm

getpts will return decimal values, so you will have to use round. I= rgb2gray((imread('TM25.jpg'))); figure,imshow(I) [x,y]=g...

Unable to select seed points manually in region growing algorithm

getpts will return decimal values, so you will have to use round. I= rgb2gray((imread('TM25.jpg'))); figure,imshow(I) [x,y]=g...

21 días ago | 0

| accepted

Answered

Out of memory. The likely cause is an infinite recursion within the program.

Inside the function trans you are calling the function trans. Without any logic to stop this, this will result in an infinite lo...

Out of memory. The likely cause is an infinite recursion within the program.

Inside the function trans you are calling the function trans. Without any logic to stop this, this will result in an infinite lo...

21 días ago | 0

Answered

Is there a way to call a part of a function using an index?

Reposting as answer: For the reasons set out in the answer by Steven (and the subsequent comments), numbering your variables in...

Is there a way to call a part of a function using an index?

Reposting as answer: For the reasons set out in the answer by Steven (and the subsequent comments), numbering your variables in...

21 días ago | 0

| accepted

Answered

check for a pair in power hand

The feasibility of this depends on the size of the arrays involved. If your vectors are too large, the implicit expansion will c...

check for a pair in power hand

The feasibility of this depends on the size of the arrays involved. If your vectors are too large, the implicit expansion will c...

22 días ago | 0

| accepted

Answered

R^2 meaning in linear mixed-effects model

The information you seek should be available on the Wikipedia page for the R². This is one of the most basic goodness-of-fit pa...

R^2 meaning in linear mixed-effects model

The information you seek should be available on the Wikipedia page for the R². This is one of the most basic goodness-of-fit pa...

22 días ago | 0

Answered

Dividing the string data

You can split this with a regular expression. str='68753-9.990e+000 -9.900e-002 -9.990e-003-3.330e+000'; RE=['[+-]?',... %s...

Dividing the string data

You can split this with a regular expression. str='68753-9.990e+000 -9.900e-002 -9.990e-003-3.330e+000'; RE=['[+-]?',... %s...

23 días ago | 0

| accepted