Answered
How to define a cell array of the full path to each folder file in my computer?
That function is not written very well: # Using |cd| is totally superfluous in that code, because simply using full filenames...

8 years ago | 0

Answered
Calculate true in binary array specifically
This is MATLAB, so you don't need to use loops to solve every little task: >> V = [0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,0,0,1,1,0,...

8 years ago | 0

| accepted

Answered
Why won't \n give me a new line?
Because all characters in the input strings are interpreted literally. With |fprintf| and |sprintf| only the format strings c...

8 years ago | 0

| accepted

Answered
Is it possible to make a dynamically changing matrix in a figure?
An easy way to do this would be to use a |uitable|: <https://www.mathworks.com/help/matlab/ref/uitable.html> Otherwise you...

8 years ago | 0

Answered
Formatting data using an if function
_"how can I adjust the data, so that the purple curve will always be connected?"_ * loop over the length of the data vector. ...

8 years ago | 0

| accepted

Answered
How to read and save different variables in a matfile to another mat file
S = load('file1.mat','var1','var2'); save('file2.mat','-struct','S') OR S = load('file1.mat'); save('file2.mat',...

8 years ago | 0

| accepted

Answered
Display value on a plot
Use <https://www.mathworks.com/help/matlab/ref/text.html |text|>.

8 years ago | 1

| accepted

Answered
How do you get around arrays not having the same dimensions when it comes to multiplication?
>> theta = (0:0.01:1).'; % column vector >> R = [0.01,0.1,1,10,100]; % row vector >> V = (theta.*R)./(R+theta-(theta.^2)...

8 years ago | 0

Answered
several questions for a beginner
The difference is explained here: <https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html> Shor...

8 years ago | 0

| accepted

Answered
Deleting repeating numbers from array
*Method one: <https://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|>:* A = [zeros(1,30),1,1,1,1,zeros(1,29),...

8 years ago | 0

| accepted

Answered
Replace portion of array with another array of different size
You cannot replace part of an array with another array that has a different number of elements (unless the replacement is a scal...

8 years ago | 1

| accepted

Answered
Resize array, prevent boundary effect
You could do this quite easily with two very simple indices: >> A = [0,1,2,3;4,5,6,7;8,9,10,11;12,13,14,15] A = 0...

8 years ago | 0

Answered
Saving newly created folder path in a variable
P = 'C:/Users/varunm1/Desktop/Assistments_Data/Confidence_MatFiles_Students_Labels/Results_Individual'; F = sprintf('Subjec...

8 years ago | 0

| accepted

Answered
How many times each element of an array have the 1 value after n times assigned different logical values?
Simple: use one 3D array: A = cat(3,... [1 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1...

8 years ago | 0

| accepted

Answered
Variation of answers with the same task
_"Why answeres are different?"_ Because the inputs are different. Take a look at the first value at a higher precision: ...

8 years ago | 0

| accepted

Answered
10>6>4
_"Can anyone explain this?"_ MATLAB has a binary operator <https://www.mathworks.com/help/matlab/ref/gt.html |gt|>, e.g. |A>B...

8 years ago | 2

| accepted

Answered
Error using zeros Size inputs must be integers.
_" I have a very bizarre problem with zeros"_ Not bizarre at all, you just need to learn about how floating point numbers wor...

8 years ago | 0

| accepted

Answered
How to delete a loaded variable with a changing name in a for loop?
If there is only *one* variable saved in each file then you can do this very easily: F = sprintf('%s.mat',PA_fname); S =...

8 years ago | 0

Answered
how to read file with name consist of number and string
You are mixing up two different paradigms for handling multiple files: first you use dir to get all of the names of any .dat fil...

8 years ago | 0

| accepted

Answered
How to subtract a value from passed variable.
Frame = [0:size(crgb,2)-1; double(crgb)];

8 years ago | 1

| accepted

Answered
I have a 21x2 cell array of string values and want to add the strings in each row together
Where |C| is your cell array: strcat(C(:,1),{' - '},C(:,2))

8 years ago | 0

Answered
How do I add elements to a structure in a loop?
Do not use a cell array of scalar structures, just use one <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-el...

8 years ago | 0

| accepted

Answered
How to construct a vector from specific elements in a matrix
With linear indexing: B = A([4,8,3])

8 years ago | 0

Answered
How to convert a cell array of singles and doubles to an array of a single type (double)?
Assuming that each cell contains a _scalar_ value: cellfun(@double,myStruct.speed)

8 years ago | 0

| accepted

Answered
If then question, find data in another column
You need to forget about using low-level loops to solve every little task and learn how to use MATLAB indexing to vectorize your...

8 years ago | 0

Answered
how to do repeating numbers in array
An old fashioned way: >> V = [1,0,0,0,2,0,0,0,3,0,0,0,0,0,5,0,0,0,0]; >> X = V~=0; >> U = V(X); >> U(cumsum(X)) ...

8 years ago | 0

| accepted

Answered
Displaying multiple values separately
>> a = [1217,-845.42]; >> fprintf('a1 = %g\na2 = %g\n',a) a1 = 1217 a2 = -845.42

8 years ago | 1

| accepted

Answered
Selecting/counting NaN elements
_"I have a cell array where some values are NaN."_ True. There are four NaN's in your cell array: >> idx = cellfun(@(v)i...

8 years ago | 0

Answered
how to combine two matlab files into single matlab
Actually it is really easy to efficiently merge two (or more) |.mat| files into one |.mat| file (to get the set union of the var...

8 years ago | 1

Load more