Answered
Cumprod for cell arrays?
_"Is this operation possible without for loops?"_ Not really. A loop is the simplest, clearest solution.

8 years ago | 0

Answered
String Input Loop not working
Your code has several bugs. In particular: * Your use of |input| evaluates the input string. MATLAB will assume that the inpu...

8 years ago | 0

Answered
How to set a value range for predefined colormap?
Set the <https://www.mathworks.com/help/matlab/ref/caxis.html |caxis|>: caxis([0,20]) Note that colormaps do NOT have va...

8 years ago | 0

Answered
How can I sort an array with two columns?
Very simply in one line using <https://www.mathworks.com/help/matlab/ref/sortrows.html |sortrows|>: >> Info = [52211,3.55;5...

8 years ago | 0

| accepted

Answered
making loop mat lab
"... but think if you have more then 3000 file how you can run this code" Start by reading the MATLAB documentation: https://w...

8 years ago | 0

| accepted

Answered
User should choose the path for saving variable once
Following the description of <https://www.mathworks.com/help/matlab/ref/uiputfile.html |uiputfile|>, try something like this: ...

8 years ago | 0

| accepted

Answered
How to assume values on an input vector
Use <https://www.mathworks.com/help/matlab/ref/numel.html |numel|> to measure how many elements the input vector has, something ...

8 years ago | 0

| accepted

Answered
populating a cell using a loop
<https://www.mathworks.com/help/matlab/ref/textscan.html |textscan|> returns a 1x55 cell array, where the format string specifi...

8 years ago | 0

| accepted

Answered
How to specifically select columns from a matrix?
>> A = [1,2;3,4;5,6;7,8;9,10] A = 1 2 3 4 5 6 7 8 9 10 >> R = [1,2,3,4,...

8 years ago | 0

| accepted

Answered
difference between e lines of codes
_"...should i use that ./ sign and where i shouldnt use it?"_ You pick the operation based on what operator you need to use. ...

8 years ago | 0

Answered
MALAB gets stuck in finding unlicensedfunctions
<https://www.mathworks.com/matlabcentral/answers/395876-undefined-function-error-is-very-slow-to-occur>

8 years ago | 0

| accepted

Answered
Defining variables inside of a function
t = 0:0.1:2; y = cos(2*t);

8 years ago | 0

Answered
how to load his code
Try something like this: S = dir(fullfile('.','training*')); N = {S([S.isdir]).name}; C = cell(1,numel(N)); for k ...

8 years ago | 0

Answered
How to write matrix to txt or excel file with specific precision
You don't need a loop. Try this: M = your matrix fmt = repmat(',%2.20f',1,size(M,2)); fmt = [fmt(2:end),'\n']; [fi...

8 years ago | 0

| accepted

Answered
Find indices in structure array for structures with field meeting a condition
If the data in the fields can be concatenated together (i.e. have the same number of rows/columns/...) then you could use a <htt...

8 years ago | 1

| accepted

Answered
trying to store data in a matrix using loop
Download my FEX submssion natsortfiles: https://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort ...

8 years ago | 0

Answered
How can I save multiple plots to separate image files with variable file name?
_"...if I create a plot of intensity for every row of pixels and save evey plot to separate image files, I have to use variables...

8 years ago | 0

| accepted

Answered
How to use for loop to read one file in multiple folders?
This should get you started: D = 'directory where the subfolders are stored'; C = cell(1,365); for k = 1:365 ...

8 years ago | 0

Answered
i want to write matlab code for x(i+1) = x(i) + 0.05*2*x(i), i=0:0.05:1, x(0) =2
Perhaps one of these does what you want: >> i = 0:0.05:1; >> x = cumsum(2+0.05*2*i) x = 2.0000 4.0050 6.01...

8 years ago | 0

Answered
How to I add loop vector iteration values to one big matrix?
Assuming that |myfun| outputs a 5-element vector, just use indexing like this: phi = 0.5:0.2:1.5; mat = nan(5,numel(phi)...

8 years ago | 0

| accepted

Answered
Matrix dimensions must agree. Error while using if.
Use <https://www.mathworks.com/help/matlab/ref/strcmp.html |strcmp|> or <https://www.mathworks.com/help/matlab/ref/strcmpi.html ...

8 years ago | 2

Answered
3D image stack; determine mean of individual arrays; error code
squeeze(mean(mean(Array,1),2))

8 years ago | 0

Answered
How can I display the answer of every iteration in a "for" loop?
_"How can I display the answer of every iteration in a "for" loop?"_ _"Whenever I run the program I only get the final value ...

8 years ago | 0

| accepted

Answered
Is there a way to execute multiple functions in Matlab at a specific time ???
<https://www.mathworks.com/help/matlab/matlab_prog/use-a-matlab-timer-object.html> For example, for your first function: ...

8 years ago | 1

| accepted

Answered
Creating Loop using vector output
The problem has nothing to do with loops, it occurs solely because you are trying to allocate multiple elements into one element...

8 years ago | 0

Answered
Cell array of coordinates from two vectors
No loops required, just use <https://www.mathworks.com/help/matlab/ref/ndgrid.html |ndgrid|> and indexing: >> X = randi(999...

8 years ago | 0

| accepted

Answered
Am I doing something wrong in cody submission?
Your function returns |y|, which is just the index from |sort| and has nothing to do with the first column of |x|. The code |...

8 years ago | 3

| accepted

Answered
What does tmp(k, n) command mean in matlab?
MATLAB does not require variables to be declared before being indexed into: when they are first referred to the variable will be...

8 years ago | 0

Answered
How to restructure/reshape matrix?
This is easy with <https://www.mathworks.com/help/matlab/ref/hankel.html |hankel|>, some indexing, and <https://www.mathworks.co...

8 years ago | 0

Answered
Change if -statement by userinput
*Method one:* use a cell array of function handles, and simply use the index from the menu to select which one you want: id...

8 years ago | 0

| accepted

Load more