Answered

Finding 4 closest points

You can design something yourself, but you could also see if fillmissing solves your problem. The documentation suggests it shou...

Finding 4 closest points

You can design something yourself, but you could also see if fillmissing solves your problem. The documentation suggests it shou...

alrededor de 1 hora ago | 0

Answered

Setting Access Properties to Public without AppDesigner

As you can see <https://www.mathworks.com/matlabcentral/answers/483657-how-to-create-a-gui#answer_412887 here>, class properties...

Setting Access Properties to Public without AppDesigner

As you can see <https://www.mathworks.com/matlabcentral/answers/483657-how-to-create-a-gui#answer_412887 here>, class properties...

alrededor de 6 horas ago | 0

Answered

How to calculate the center of white part?

The best way is to use something like regionprops, but since you only have a single patch, you can use find to get a list of coo...

How to calculate the center of white part?

The best way is to use something like regionprops, but since you only have a single patch, you can use find to get a list of coo...

2 días ago | 1

| accepted

Answered

how to plot a function

The same as any other function: find a vector of x data and calculate the y data. Then you can use plot. You can use plot3 for x...

how to plot a function

The same as any other function: find a vector of x data and calculate the y data. Then you can use plot. You can use plot3 for x...

3 días ago | 0

Answered

Nominate yourself to become a member of MathWorks Community Advisory Board

You can find the current members of the MATLAB Central Community Advisory Board on this page. At the bottom of that page, you c...

Nominate yourself to become a member of MathWorks Community Advisory Board

You can find the current members of the MATLAB Central Community Advisory Board on this page. At the bottom of that page, you c...

4 días ago | 0

Answered

Use API in matlab

You're in luck: NASA decided to provide the data in JSON, and Matlab can parse that JSON output for you: url='https://power.lar...

Use API in matlab

You're in luck: NASA decided to provide the data in JSON, and Matlab can parse that JSON output for you: url='https://power.lar...

4 días ago | 0

Answered

Deployed exe with configuration file

It sounds like you need something very similar to my GetWritableFolder function. You can use the second output to confirm the f...

Deployed exe with configuration file

It sounds like you need something very similar to my GetWritableFolder function. You can use the second output to confirm the f...

4 días ago | 0

| accepted

Answered

simple calculator using GUI

For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. Every callback is a ...

simple calculator using GUI

For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. Every callback is a ...

4 días ago | 0

| accepted

Answered

How I can optimize my code for a stack construct?

Dynamically growing a variable is generally slow, because Matlab needs to copy the entire array. You could pre-allocate a stack...

How I can optimize my code for a stack construct?

Dynamically growing a variable is generally slow, because Matlab needs to copy the entire array. You could pre-allocate a stack...

4 días ago | 0

Answered

Subset of an array with a moving window

The code below relies on implicit expansion to create an index array, which replicates the results from the inner for-loop. Sinc...

Subset of an array with a moving window

The code below relies on implicit expansion to create an index array, which replicates the results from the inner for-loop. Sinc...

7 días ago | 1

| accepted

Answered

How to make a simple grid of coordiantes ?

If you read the documentation, you can see how to plot vectors without plotting connecting lines. As for generating the coordin...

How to make a simple grid of coordiantes ?

If you read the documentation, you can see how to plot vectors without plotting connecting lines. As for generating the coordin...

7 días ago | 1

| accepted

Answered

Merging existing subplots into a single one

This is a surprisingly difficult task. You will have to copy all objects to the same figure and adapt the Position properties of...

Merging existing subplots into a single one

This is a surprisingly difficult task. You will have to copy all objects to the same figure and adapt the Position properties of...

7 días ago | 0

Answered

How to find the exact answer of an exponential equation?

You can use double to extract a numerical value, but if you're looking for a time, something is going wrong here. The numerical ...

How to find the exact answer of an exponential equation?

You can use double to extract a numerical value, but if you're looking for a time, something is going wrong here. The numerical ...

7 días ago | 0

Answered

How to find maximum value and corresponding x-value of multiple graphs?

This is trivial if you use an array instead of numbered variables: z{1}=zeros(numel(fv),1); z{2}=zeros(numel(fv),1); z{3}=zer...

How to find maximum value and corresponding x-value of multiple graphs?

This is trivial if you use an array instead of numbered variables: z{1}=zeros(numel(fv),1); z{2}=zeros(numel(fv),1); z{3}=zer...

7 días ago | 0

| accepted

Answered

Tips on combining while loop

You were creating a function, why not make that explicit? %Pohlhausen/thwaites polynomial %clear;clc;close; % ^^^^^^ you do...

Tips on combining while loop

You were creating a function, why not make that explicit? %Pohlhausen/thwaites polynomial %clear;clc;close; % ^^^^^^ you do...

8 días ago | 0

Answered

Strange behavior of if statement

Welcome to floating point integers. Matlab stores these numbers in a binary representation with a finite precision. Similar to ...

Strange behavior of if statement

Welcome to floating point integers. Matlab stores these numbers in a binary representation with a finite precision. Similar to ...

8 días ago | 0

| accepted

Answered

Create interface to control my instruments.

For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. You can use a callba...

Create interface to control my instruments.

For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. You can use a callba...

9 días ago | 0

Answered

How to split .mat data into different variables?

You can't have a file in your workspace, only variables (and objects if you don't count those as variables). There are some gue...

How to split .mat data into different variables?

You can't have a file in your workspace, only variables (and objects if you don't count those as variables). There are some gue...

9 días ago | 0

| accepted

Answered

Can you have a function for multiple scripts that are growing in size?

Scripts are not for real work, use functions instead. Functions allow you to write code that solves a specific problem. You can ...

Can you have a function for multiple scripts that are growing in size?

Scripts are not for real work, use functions instead. Functions allow you to write code that solves a specific problem. You can ...

9 días ago | 0

| accepted

Answered

Error in saveas, invalid or missing path

You should create a path from parts by using fullfile. That way you avoid having to think yourself about which filesep to use. ...

Error in saveas, invalid or missing path

You should create a path from parts by using fullfile. That way you avoid having to think yourself about which filesep to use. ...

9 días ago | 0

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

10 días 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...

10 días 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)~...

11 días 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. ...

11 días 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...

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

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

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

15 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,:)); ...

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

17 días ago | 0

| accepted