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

Answered
How to convert the data from three array: x,y,z into mesh format
>> X = [1,1,1,2,2,2]; >> Y = [1,2,3,1,2,3]; >> Z = [4,5,3,2,7,6]; >> uX = unique(X); >> uY = unique(Y); >> S = ...

8 years ago | 1

Answered
subset of varargin as function input
Try this: function plotFT(varargin) switch nargin case 10 fun1(varargin{:}) case 13 ...

8 years ago | 2

| accepted

Answered
Speeding up writing a very large text file
_"To solve this problem I broke the output into blocks ..."_ What problem? MATLAB has no problem with |fprintf| used on milli...

8 years ago | 3

| accepted

Answered
Plots are overriding each other, and I do not know why
_"Plots are overriding each other, and I do not know why"_ *Summary* Because that is exactly what you are telling MATLAB to d...

8 years ago | 3

| accepted

Answered
Extracting numeric values from character array
This is easy with <https://www.mathworks.com/help/matlab/ref/sscanf.html |sscanf|>: >> coords = ['[ 48. -24. 48.]';'[ 50. ...

8 years ago | 2

| accepted

Answered
How do I create multiple parallel lines
Plotting lots of lines is not the correct solution, you should use the <https://www.mathworks.com/help/matlab/ref/grid.html |gri...

8 years ago | 2

| accepted

Answered
How do I get matlab to list all numbers from 1 to 100 divisible by 6?
Method zero: |colon| and |times|: >> 6.*(1:16) ans = 6 12 18 24 30 36 42 48 54 60 66 72 7...

8 years ago | 4

Load more