답변 있음
I need two outputs and I'm only getting one, please help me
You didn't actually assign any outputs, so Matlab only stores the first one in ans. If you want to actually store variables you ...

5년 초과 전 | 0

답변 있음
What is the probability that their children can travel in a straight line between any two points without leaving the boundary? In other words, what is the probability that the boundary is a convex quadrilateral? 
If you want to do a Monte-Carlo-style simulation, I would suggest using rand to generate the coordinates. I would suggest puttin...

5년 초과 전 | 0

답변 있음
Annually averaging of a 4D matrix
You are using the color operator incorrectly. 1:2:3 doesn't mean [1 2 3], but [1 3]. If your syntax does indeed work for you, t...

5년 초과 전 | 0

| 수락됨

답변 있음
finding a phrase in a modularized code with over 1000 functions
You can use Matlab tools, as Ameer describes, but you can also use external software. I personally find the performance of searc...

5년 초과 전 | 0

답변 있음
How to plot data with >2 dimensions?
Apart from plot3 (as Alan suggested), you may also consider using subplot to divide the different scenarios and using hold to pl...

5년 초과 전 | 0

질문


minify Matlab code (minimize number of characters)
I would like to find a way that reduces the footprint of a function as much as possible. The actual functionality should not cha...

5년 초과 전 | 답변 수: 2 | 2

2

답변

답변 있음
How can I get my figure window to pop up with the animation playing when I execute the code?
You probably mean you want to make the figure the current figure and bring it to the foreground. If so: figure(1) cla;%i...

5년 초과 전 | 0

| 수락됨

답변 있음
Find the element that is a sqrt of another element in the same array function?
To compare many elements to each other I would recommend the ismember function.

5년 초과 전 | 0

답변 있음
Refresh annotate on figure in loop
Create the annotation object once, and update the String property inside your loop. I would suggest drawnow to trigger the upda...

5년 초과 전 | 0

답변 있음
Locate elements of a vector inside a meshgrid
I would suggest using ismembertol, or consider functions like normxcorr2 from the image processing toolbox.

5년 초과 전 | 0

답변 있음
How do I read this file and extract the data to plot and average it
Good call on not using str2num, you should consider using str2double (or textscan or datetime) instead: [date,value]=read_json_...

5년 초과 전 | 0

답변 있음
clean all paths except factory ones (toolboxes)
Appart from using restoredefaultpath, you might consider borrowing code from toggleToolbox to toggle the states of your path.

5년 초과 전 | 0

답변 있음
How do I create an exact looping code for my following problem?
You are remove all elements from phi, so your second iteration does what you ask: nothing. Please learn how to use the debuggin...

5년 초과 전 | 0

답변 있음
Crop a part of binary image
My suggestion would be to determine the number of white pixels in each column, and use an automatic way to determine a threshold...

5년 초과 전 | 0

| 수락됨

답변 있음
I'm having problem while running a code with nested for loops. I'm not able to generate the output graph
I'm not going to read your code when it is like this, but the most common source of the issue is that people are not indexing th...

5년 초과 전 | 0

답변 있음
What is it called when I specify a vector output of solutions from, say, fsolve?
Those are called output arguments. Sometimes functions will use the nargout function to determine which calculations should be p...

5년 초과 전 | 1

| 수락됨

답변 있음
Output argument "xn" (and maybe others) not assigned during call to "myGeneralRecursion".
You're close with the components of your function, but you're not quite there. Your function is trying to find a value for xn. I...

5년 초과 전 | 0

답변 있음
Importing a two column array from excel
You forgot to put the quotes in your first call. That makes Matlab treat it like a variable, not a char array.

5년 초과 전 | 1

답변 있음
how to make a looping function to delete all members in a phi set?
You don't update the original variable, but you create a new one instead. You also have made a typo when writing the code here, ...

5년 초과 전 | 0

답변 있음
Fast subsetting or indexing of data
Whenever you find yourself copy-pasting code in Matlab, you should consider an array. seasons={'Spring','Summer','Autumn','Wint...

5년 초과 전 | 0

| 수락됨

답변 있음
What frustrates you about MATLAB? #2
Comment posted by John in the previous thread: Matlab should 'update' the new version instead of installing the new version. Th...

5년 초과 전 | 1

답변 있음
How to read data from a file into cell array keeping indents undisturbed
You can get my readfile function from the FEX or through the AddOn-manager (R2017a or later). It will read a file to a cell arr...

5년 초과 전 | 3

답변 있음
How to asign Unicode string to popup menu without fonr error?
Since you're using a release pre-R2020a, the default to store m-files is not UTF-8. That means any special character has a very ...

5년 초과 전 | 0

| 수락됨

답변 있음
SOS: How do I get the same amount of positive and negative values in a random vector?
Your question differs from your description. If you want to select the points with both x and y above 0, you need to use both as...

5년 초과 전 | 1

답변 있음
bug in power calcultion while in loop ?
This is not a bug. Look at the exponent: 2e-16 is very small. It is close enough to eps that you can assume that is just 0. The...

5년 초과 전 | 1

| 수락됨

답변 있음
Reshape panel data to wide using text scan
If you want to read an Excel file you can use the aptly named xlsread function. The second or third output is probably what you ...

5년 초과 전 | 0

답변 있음
Redistribution of histogram type data in specified bins
You should be really careful with this resampling, especially for so few samples. Since you're assuming a flat distribution in ...

5년 초과 전 | 0

답변 있음
Need help with perimeter of polygon
Step by step. Split up your problems in manageable parts. If you have the coordinates of all corners of your polygon, you can u...

5년 초과 전 | 0

답변 있음
matlab calculation area circular
You can use trapz for a numerical approximation of an integration. By selecting your bounds you can use this to calculate the ar...

5년 초과 전 | 2

| 수락됨

답변 있음
Code is not working, can someone help me?
This should fix it: function s = Sum1(x,y,z) s = 0; for i=0:min(x,y) for k=0:x-i s = s + (-1)^k * QuantumDi...

5년 초과 전 | 1

더 보기