Answered
How to create a loop that runs a function and save output through subfolders in a directory?
I replicated your file structure as I understood your explanation, it looks like this: Obviously I do not have your data file...

6 years ago | 0

| accepted

Answered
How to connect end points for different series in a line plot?
N = [0,1,2,3,4,5]; % n = ts/tau Y = zeros(1,numel(N)); % new C = cell(1,numel(N)); % new f = @(t_star,y,n) 1-y-(t_star/n); %...

6 years ago | 0

| accepted

Answered
How to convert a 1x64 size cell to a struct with 2 fields?
Where C is your cell array: S = [C{:}] https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html https://w...

6 years ago | 0

Answered
comparing between two identical variables returns logic 0?
"as you can see in the command window bk(6) equals ak(2)" Nope. Just looking at some floating point values displayed in the com...

6 years ago | 0

| accepted

Answered
Creating several structures within another structure
MATLAB does not limit how much nesting you can do with any container arrays. tubing.nodes = struct('X',1); tubing.elements = s...

6 years ago | 0

| accepted

Answered
how to put an overline for \alpha_{KZ}
ylabel('$\overline{\alpha_{KZ}}$','interpreter','latex')

6 years ago | 1

Answered
How to change the field width of an exponential notation?
Given >=2 digits, ensure >=3 digits: >> val = 3.45866636216603e2; >> str = sprintf('%.14e',val) str = 3.45866636216603e+02 ...

6 years ago | 0

| accepted

Answered
how do i delete questions?
You need to call the function with all of its output arguments, e.g. (pick the names to suit your needs): [A,B,C,D] = DiagDom()...

6 years ago | 0

| accepted

Answered
How to store multiple arrays into a single one?
Use a cell array: C = {array_1,array_2} https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-cell-array.html

6 years ago | 0

| accepted

Answered
Trying to graph function giving me an incorrect scale
"....but am I multiplying something wrong?" Yes: you used matrix operations, whereas you need to use element-wise array operati...

6 years ago | 2

Answered
My variable are not being recognized or are stuck inside of the loop
Do NOT call input inside your functions (nor for that matter, have any user interaction, file import/export, etc.). You need to...

6 years ago | 0

| accepted

Answered
Inserting matrices in a cell - in a for loop
You need to get the data out of the cell array before concatenating it with the new data, i.e. replace wholedff{c_event} = [who...

6 years ago | 0

| accepted

Answered
Nested if else statements
Badly indented code hides bugs. Your code is badly indented. Your badly indented code hides the bug that causes that error mes...

6 years ago | 1

Answered
How to programatically make workspace variable name same as the .mat file name loaded into Matlab?
A much better approach than awful dynamic variable names is to use simple, efficient indexing, e.g.: D = 'path to the directory...

6 years ago | 0

| accepted

Answered
Textscan: How to skip a delimiter present within single quotes
>> str = fileread('test.txt') str = string1 = string2 ; xyz.data = 'string3(1 = string4; 0 = string5)' ; sring6; >> out = te...

6 years ago | 0

Answered
Converting a coloumn of characters into number for logistic regression
For that character array: >> v = all(a=='pass',2) v = 1 0 1 0 0 1 If you really have a cell array of charac...

6 years ago | 0

Answered
How to access a file in another directory
The problem is that you are using command syntax (an unfortunate remnant of MATLAB's venerable origins): https://www.mathworks....

6 years ago | 2

| accepted

Answered
Return value based on multidimensional table/interpolation
The simplest solution would be to use griddatan: https://www.mathworks.com/help/matlab/ref/griddatan.html Note that it only su...

6 years ago | 1

| accepted

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

Load more