Answered
Can a function access variable which were not input variables?
_"Can a function access variable which were not input variables?"_ Yes: this is easy using <https://www.mathworks.com/help/ma...

8 years ago | 0

Answered
Vectorization of a nestled loop
You can use <https://www.mathworks.com/help/matlab/ref/mtimes.html matrix multiplication>: matA.'*B(:) which gives an ou...

8 years ago | 0

| accepted

Answered
why meijerG function is undefined variable in matlab
Probably you don't have the Symbolic Toolbox installed, or you don't have a license for it, or the function is not supported for...

8 years ago | 0

| accepted

Answered
ode45 error: must return a column vector
p = v-(s0.*v.*x)./g; You need to learn about the differences between matrix operations and array operations: <https://ww...

8 years ago | 0

Answered
Why does my cellfun fails?
_"...however if I try to apply the same command again as..."_ You have failed to take into account that inbetween running the...

8 years ago | 0

| accepted

Answered
How can I read and plot files with dynamic name and plot them in a single graph?
Depending on what numeric values those filenames contain, this might not be so trivial. To get the files in the correct order yo...

8 years ago | 1

Answered
How do I calculate the maximum value of an array of structures within a structure ?
Here is one simple solution _that does not rely on a specific order of any of the fieldnames_: % fake data (fields not in n...

8 years ago | 0

Answered
How to separate vector into vectors of different lengths
The simple MATLAB way: >> y = 1:10; >> x = [2,5,10]; >> c = mat2cell(y,1,diff([0,x])); >> c{:} ans = 1 ...

8 years ago | 2

Answered
[GUI] Update variable in while loop
If you want any values of |handles| to change inside that loop because of something that you did in another callback then you wi...

8 years ago | 0

| accepted

Answered
COMBINING MULTIPLE TABLES TOGETHER
_"I have used the eval function to do the job but I want to do it without eval function??"_ That is a good idea, because |eva...

8 years ago | 0

Answered
Iteratively save data to mat file
_"I would prefer that all the data is saved to a single variable in a single Mat file but I don't see how to do that efficiently...

8 years ago | 1

Answered
Unable to draw files from a folder
This will get all the filenames, remove the filenames starting with |._|, sort the filenames into alphnumeric order, and then im...

8 years ago | 1

| accepted

Answered
store image in a handle.
When you save |I| using |guidata| you replace the |handles| structure with |I|, and so |handles| does not exist any more (and he...

8 years ago | 0

| accepted

Answered
hi,this is my code
Replace this: >> z=[1:1:2339]; >> [Z]=meshgrid(z); With something like this: >> Z = nan(size(Y)); >> Z(:) = 1...

8 years ago | 0

Answered
How to find and store specific parameters in text file.
One very simple solution would be to read the whole file and use a regular expression. Something like this: D = 'directory ...

8 years ago | 0

Answered
how to find the minimum value of the wholw matrix?
This works for any size array: min(A(:))

8 years ago | 5

Answered
Number of times two numbers appear together
>> A = [1,3,2,4,3,4,3,2,1,1,3,2,4,3,3,2]; *Method one: basic indexing and |nnz|:* >> nnz(A(1:end-1)==1 & A(2:end)==2) ...

8 years ago | 0

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements. Error in Assignment6ExcelCodyMadsen (line 44) letter(i) = 'B+' ; How do I fix this problem?
What you are doing will not work: |(i)| refers to *one* element of the char array |letter|, and it is not possible to force mult...

8 years ago | 0

Answered
I want to do a least squares fit to the values around a matrix diagonal including the diagonal itself.
_"How do I query the values in a matrix surrounding the diagonal?"_ <https://www.mathworks.com/help/matlab/ref/diag.html>

8 years ago | 0

Answered
Where am I going wrong in my for loop? I am getting NaNs
The only problem I can see is that you forgot to put the semi-colon on the end of the line. That will display |T_num| on ever...

8 years ago | 0

Answered
Why is MATLAB messing up this very simple calculation.
_"MATLAB calculated the wrong number!"_ Nope, MATLAB calculated the right number. The reason is simply that the value |-2....

8 years ago | 1

| accepted

Answered
(subjectively) IMPORTANT QUESTION! Please help.
_"The problem that I am having is that, I receive an "OUT OF MEMORY" error from MATLAB after going through 3 mice."_ Basicall...

8 years ago | 0

| accepted

Answered
How do I create a filename for TIFF's that change in every loop. Like P01.TIFF then P12.TIFF and so forth. I've set up this in strings but I think the single quotes are missing.
Your code is very verbose for such a simple operation. I recommend using neater <https://www.mathworks.com/help/matlab/ref/sprin...

8 years ago | 0

Answered
Why this error with `axis`
The actual answer is that you _can_ combine multiple inputs, but that those inputs are _not_ name-value inputs (like many other ...

8 years ago | 0

Answered
How to convert cell to double ??
Another guess: str2double @Farman Shah: you have not told us what is _in_ the cell array, so we have no idea what the da...

8 years ago | 0

| accepted

Answered
How to find component of a max value?
Just get the second output from <https://www.mathworks.com/help/matlab/ref/max.html |max|>, which is the index of the maximum va...

8 years ago | 0

| accepted

Answered
Add values to vector
_"I also thought about somehow replacing the 1 in B by values of A"_ You can use logical indexing. Here is an example that wi...

8 years ago | 0

| accepted

Answered
While loop causing an infinite loop in MATLAB
_"Can I get an explanation as to why the code is entering this infinite loop?"_ Of course, it is very simple: you are using a...

8 years ago | 1

| accepted

Answered
How can i write the function which input is a 3×3 matrix, named A, and the program should output corresponding picture in a txt file. The number in matrix A determines how many cubes should be located in the corresponding position.
Here is one approach using simple loops and indexing. You will have to do some fine-tuning to get it to suit your requirement...

8 years ago | 1

| accepted

Answered
Extracting numbers from mixed string
Fully vectorized, one line, and more efficient than |regexp| and/or |str2double|: >> C = {'2001_06m','2001_7m','2001_08'}; ...

8 years ago | 1

Load more