Answered
extracting the last three characters from cell array
You probably want to extract the extension, instead of hard-coding the last three characters: data={'COD0MGXFIN_20210870000_01D...

5 years ago | 1

Answered
Calculate mean from a cell array.
Two options of what you could mean: %load your data first websave('data.mat','https://www.mathworks.com/matlabcentral/answers/...

5 years ago | 0

| accepted

Answered
Assign values in the cell
You mean like this? output1={[1 2;3 4],[]}; L=cellfun(@isempty,output1); output1(L)={zeros(8,1)}; output1 Note that cellfun...

5 years ago | 0

| accepted

Answered
Right way to insert files paths into code
Personally I use a function like the one below to semi-hard-code the paths. The context for this is that I have a synced folder,...

5 years ago | 1

| accepted

Answered
How can add stop button and command in GUI
The general solution is to have the stop button set a flag (either in the guidata or in the UserData property of an object). %i...

5 years ago | 0

| accepted

Answered
string data type is not a class?
help methods This suggests that you can't use the methods(object) syntax for char and string inputs. methods('1') methods(cla...

5 years ago | 0

| accepted

Answered
cell cal from function problem
If you pre-allocate the cell array you can use a comma separated list: [input1, input2, input3, input4]=deal(rand); AA=cell(...

5 years ago | 0

| accepted

Answered
Getting around overuse of "if" statements.
You should use the value of DAY to set the value of a variable you can use as the range. You should also use strcmp to compare c...

5 years ago | 1

| accepted

Answered
How to calculate a median value of each interval?
%generate some random data temperature=15+10*rand(8767,1); phase=360*rand(size(temperature)); temperature_rounded=round(tem...

5 years ago | 0

| accepted

Answered
Have you figured out an easy way to publish your MATLAB projects for public consumption?
(this is not a drop-in solution) You could bundle your m-file with a copy of GNU Octave. The main upside is that it will be fr...

5 years ago | 1

| accepted

Answered
How to plot the convolution of 2 functions
You didn't do the convolution on a function. However, since the vectors you did use are the y values of functions (with a shared...

5 years ago | 0

| accepted

Answered
I want to load a folder in appdesigner by using "button" and to load the path of the folder in the "EditField". How?
The uigetdir function only has 1 output. folder = uigetdir(); if isequal(folder,0) ...

5 years ago | 0

| accepted

Answered
extracting all lines includes specific string from text file
You can get my readfile function from the FEX. %If you don't use the readfile function, you can use readlines instead readfile...

5 years ago | 1

| accepted

Answered
Subtracting Current and Previous Value of the same variable
No,that is not possible. What you can do is create a new variable which contains the previous value of a. Then you can trivially...

5 years ago | 0

Answered
Pause execution of While loop and resume from the same point with PushButtons App Designer
The reason for your issue is that you're using toc, which will still continue running. If you measure how long your GUI has bee...

5 years ago | 0

| accepted

Answered
I want to compare two arrays and check that which value is missing in second array as compared to first one?
You should avoid variable names like sum, as that will prevent you from using the sum function. Your question sounds like you n...

5 years ago | 0

| accepted

Answered
Modifying a Variable if a condition is met
Array operation in Matlab tend to be much faster than other solutions. This is a situation where you can use logical indexing: ...

5 years ago | 0

| accepted

Answered
Build a relation between matrix components
It is almost possible to use a convolution to solve your question, but I couldn't see how, so I did it with a replicated array. ...

5 years ago | 1

| accepted

Answered
How to convert timestamp string to datetime object in matlab
UTC_epoch_seconds=1303133628; UTC_offset=UTC_epoch_seconds/(24*60*60); atomTime=UTC_offset+datenum(1970,1,1); datetime(atomTi...

5 years ago | 1

| accepted

Answered
Edit field in app designer
app.spottedRegionsEditField.Value=N_objects; You need to put this in OpenButtonPushed (along with the code to calculate N...

5 years ago | 1

| accepted

Answered
MCR version 7.15
<https://www.mathworks.com/products/compiler/matlab-runtime.html> Open MATLAB and run the command mcrinstaller to locate MATL...

5 years ago | 0

Answered
How to pass 3 variables from a script into a function and get 1 output?
Where are the letters coming from? Anyway, if you want to do something like this, you should use strcmp to compare char arrays....

5 years ago | 0

| accepted

Answered
How to arrange datetime vertically
Transpose should work as expected: (datetime(2012,02,01):datetime(2021,12,31)).'

5 years ago | 0

| accepted

Answered
How can I find a faster way to calculate the transpose of a matrix?
The transpose is not required. You can use the second input to sum to change dimension along which it operates. Also, an abso...

5 years ago | 0

| accepted

Answered
Create a top hat function
If you realize that you are marking all true locations with 1 and leaving all false as 0, you can use that to make an anonymous ...

5 years ago | 0

| accepted

Answered
Finding a string in a string
Split into groups of 3 (with mat2cell or with regexp), use ismember to find the position of each codon in a dictionary array (wh...

5 years ago | 0

Answered
How to modify the y-axis tick label and tick values (2016a)
The trick is to select part of your YTickStr: L=round(linspace(1,size(YTickStr,1),5)); % use round to round to integer indices...

5 years ago | 1

| accepted

Answered
Use of nested function in MATLAB app designer
You can use the callback functions of your buttons to replace the graphs and labels: function torquevsSpeedButtonPushed(app, ev...

5 years ago | 0

| accepted

Answered
¿como transformo un vector a un polinomio para graficar la función?
doc polyval doc plot

5 years ago | 0

| accepted

Answered
How can I plot (y vs t) and (z vs t) in one graph?
If you use array inputs to your anonymous function you can use the plot function.

5 years ago | 1

| accepted

Load more