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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

| accettato

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

Domanda


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

oltre 5 anni fa | 2 risposte | 2

2

risposte

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

oltre 5 anni fa | 0

| accettato

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 0

| accettato

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 1

| accettato

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

oltre 5 anni fa | 0

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

oltre 5 anni fa | 1

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

oltre 5 anni fa | 0

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

quasi 6 anni fa | 0

| accettato

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

quasi 6 anni fa | 1

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

quasi 6 anni fa | 3

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

quasi 6 anni fa | 0

| accettato

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

quasi 6 anni fa | 1

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

quasi 6 anni fa | 1

| accettato

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

quasi 6 anni fa | 0

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

quasi 6 anni fa | 0

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

quasi 6 anni fa | 0

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

quasi 6 anni fa | 2

| accettato

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

quasi 6 anni fa | 1

Carica altro