Answered
How to count number of times a number appears in column B based on column A
Using a table makes the counting easy: >> T = table(); >> T.letters = {'A';'B';'A';'A';'C';'D'}; >> T.columnB = [ 1; 2; 2;...

6 years ago | 0

Answered
Matlab is calculating standard deviation wrongly
It is not wrong. The difference is explained in detail here: https://en.wikipedia.org/wiki/Standard_deviation#Corrected_sample_...

6 years ago | 1

Answered
Creating a Matrix with for loop
Simpler, no data duplication, fewer intermediate variables with less memory footprint: >> X = [2,1,2,10,3,0,0,0,0;2,2,3,20,5,0,...

6 years ago | 1

Answered
Why does gradient function calculate wrong dimensions 1 and 2?
>> mygrad = @(m)gradient(permute(m,[2,1,3:ndims(m)])); >> [gxx,gyx,gzx] = mygrad(mshx); >> [gxy,gyy,gzy] = mygrad(mshy); >> [...

6 years ago | 1

| accepted

Answered
How to use ismember to assign values from one cell array to another cell array
Assuming that each cell contains exactly one character: >> [idx,idy] = ismember(cell2mat(y(:,2:3)),cell2mat(x(:,2:3)),'rows'); ...

6 years ago | 0

| accepted

Answered
Find the elements of a ND matrix given the index of the elements
Surprisingly there is no trivial way to do this, but one general solution is to generate linear indices, e.g.: % input data (an...

6 years ago | 1

| accepted

Answered
Finding all consecutive numbers of different lengths within a vector
>> A = [25,26,27,28,55,56,80,81,82,100,101,102,103,104,105,155,156]; >> X = A([true,diff(A)~=1]) X = 25 55 80 100...

6 years ago | 0

| accepted

Answered
Why can't I convert from datenum to datetime?
You imported that data into a table (e.g. using readtable) and so you are using the wrong indexing: https://www.mathworks.com/h...

6 years ago | 0

| accepted

Answered
How to form a matrix with the existing 7 matrices with following rules
This is easiest when you avoid anti-pattern numbered variables and use one array, e.g. a cell array: W = rand(6,6); C = {rand(...

6 years ago | 1

| accepted

Answered
How to use subs() instead of eval()?
Following the Symbolic Toolbox documentation, you need to use double: val = double(subs(...)) https://www.mathworks.com/help/s...

6 years ago | 1

Answered
a function problem about output number
You need to call the function with two outputs, e.g.: [N1,N2] = tekcift(... whatever inputs you use...) Very basic MATLAB conc...

6 years ago | 0

Answered
Deleting Rows inbetween NaN values.
>> V = [1,4,5,NaN,0,9,3,1,3,NaN,1,5,3,0,7,NaN,7,4,2,1,NaN,9,4]; >> X = isnan(V); >> Y = cumsum(X); >> F = @(n) V(~X&(n==Y)); ...

6 years ago | 2

Answered
My matlab code is only returning first output
You need to call the function with all three outputs, e.g.: [Vout, Iout, E] = kretsen2(); Very basic MATLAB concepts, such as ...

6 years ago | 0

| accepted

Answered
Convert a cell of 'yes' and 'no' into array of 1 and 0
out = strcmpi(Data,'yes')

6 years ago | 1

| accepted

Answered
Failed to save .eps file
"However, the file can not work with Latex editor as it converts the .eps figure into blank .pdf file. Any suggestion please?" ...

6 years ago | 1

Answered
row circular shift in matrix
Simpler using circshift, where k<0 shifts to the left and k>0 shifts to the right: M(row,:) = circshift(M(row,:),k,2)

6 years ago | 0

Answered
How do I ensure an input as a number and not a letter/set of letters?
It is more robust to return a character vector from input: p = 'Write the number of the converter you want to open here: '; x ...

6 years ago | 0

| accepted

Answered
How to parse an Nx1 string array without looping through N
Using one simple regular expression: C = {... 'nsasondewnpnC1.b1.20020428.184800.cdf'; ... 'nsasondewnpnC1.b1.2002042...

6 years ago | 0

| accepted

Answered
Sequential, row-wise reshape of an M–by–N matrix to form a 1–by–N vector
reshape(A.',1,[])

6 years ago | 1

| accepted

Answered
Selecting Elements of Matrix Given Index Value...
x = A(i,:) Or without the loop: x = A(omit,:) Very basic MATLAB indexing like this is explained in the introductory tutorials...

6 years ago | 2

| accepted

Answered
Why can't the variable "sumt" in my for loop keep on adding numbers?
"Why can't the variable "sumt" in my for loop keep on adding numbers?" Because of the class of mat. Most likely mat has class ...

6 years ago | 1

| accepted

Answered
column circular permutaion on a matrix
No loops: >> A = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]; >> S = [2,1,3,2]; % shifts >> [R,C] = ndgrid(1:4,1:4); >> B = A(s...

6 years ago | 0

Answered
What does this error mean? Undefined operator '*'
On this line f=@(r)... you defined f to be a function handle of an anonymous function with one input argument. Multiplication ...

6 years ago | 1

| accepted

Answered
If statement in loop not recognized
The problem is likely to be this invented syntax: T_per_rotor - 5 < Lift < 5 + T_per_rotor MATLAB does not have ternary logic...

6 years ago | 0

Answered
I accidently set my account in french
Scroll to the very bottom of this page. Click on this button (bottom left) Select the language you want to use.

6 years ago | 1

| accepted

Answered
Ensamblar varias submatrices en una matriz
>> M = [1,5,6,1,2,5;7,9,11,3,4,6]; >> V = nan(1,6); >> V(M(:,4:6)) = M(:,1:3); >> AA = diag(V) AA = 1 0 0 ...

6 years ago | 0

Answered
Plotting from a Loop - "Error: This statement is incomplete"
You are still writing the whole thing as a character vector. I don't see any examples in the documentation like that: https://w...

6 years ago | 0

| accepted

Answered
A Sprintf For Loop Breakdown
"I don't understand the sprintf what does the %3.3d.jpg do" It is confusing because that formatting string uses undocumented be...

6 years ago | 1

| accepted

Answered
How to divide an array into separate arrays when the division concerns a proportion of the cell?
% data: D = [1.1,1.2,1.4,1.7,2.0,2.3,2.7,3.1,3.6,4.2]; nb = 10; Lb = 2.45; x = [0;4;7;11;16;24.5]; % code: Lw = linspace...

6 years ago | 1

| accepted

Answered
How to divide the cell array content into columns?
You don't need the cell array, it would be simpler with array2table: M = max(mo(:,2:7)); Tit = array2table(M,...)

6 years ago | 0

| accepted

Load more