답변 있음
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/...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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,...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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(...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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) ...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 0

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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: ...

4년 초과 전 | 0

| 수락됨

답변 있음
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. ...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 1

| 수락됨

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

4년 초과 전 | 1

| 수락됨

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

4년 초과 전 | 0

답변 있음
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....

4년 초과 전 | 0

| 수락됨

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

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
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 ...

4년 초과 전 | 0

| 수락됨

답변 있음
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...

4년 초과 전 | 0

답변 있음
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...

4년 초과 전 | 1

| 수락됨

답변 있음
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...

4년 초과 전 | 0

| 수락됨

답변 있음
¿como transformo un vector a un polinomio para graficar la función?
doc polyval doc plot

거의 5년 전 | 0

| 수락됨

답변 있음
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년 전 | 1

| 수락됨

답변 있음
How to plot based on the shortest vector?
I was just about to comment something along the lines of the answer @Scott MacKenzie posted. The idea is that you find out what ...

거의 5년 전 | 1

더 보기