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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

Frage


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

fast 6 Jahre vor | 2 Antworten | 2

2

Antworten

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

Beantwortet
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_...

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 1

Beantwortet
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, ...

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 1

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

fast 6 Jahre vor | 3

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

fast 6 Jahre vor | 0

| akzeptiert

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

fast 6 Jahre vor | 1

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

fast 6 Jahre vor | 1

| akzeptiert

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 0

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

fast 6 Jahre vor | 2

| akzeptiert

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

fast 6 Jahre vor | 1

Mehr laden