Answered
Create folders and organize data based on file name.
movefile('*CP-A-01*.*', 'newdir01') movefile('*CP-B-01*.*', 'newdir02')

12 days ago | 0

Answered
Is it possible to create a nested structure with dynamic field names?
"However, this version of dot indexing (right side dynamic naming) is not supported." Lets try it right now: S.A.B.C = pi; S....

12 days ago | 1

| accepted

Answered
How do I print a legend using a character array and integer array?
COMPOSE() is perfect for this, but was first introduced in R2016b. You could use ARRAYFUN() or CELLFUN(): C = {'Current','Curre...

14 days ago | 0

| accepted

Answered
Removing neighbours that are too close from eachother in a vector
x = [1,8,9,10,15,20,22,25,34] [~,~,y] = uniquetol(x, 5, 'DataScale',1); z = accumarray(y(:),x(:),[],@(v) v(ceil(end/2)))

14 days ago | 1

| accepted

Answered
Create a row vector comparing strings in a for loop
The simple MATLAB approach: s1 = { 'FMO1','FMO2','FMO3','FMO4', 'BAO1', 'BAO2', 'BAO3', 'BAO4'}; s2 = {'mean','FMO1','BAO4','F...

15 days ago | 1

Answered
Convert string array to numetric.
data = ["01";"01";"10";"10";"01"] M = char(data)-'0'

15 days ago | 1

Answered
How can i change struct size
S = load('sample_data.mat') E = S.ECOG E.locations E.locations(49:end) = [] % remove those structure elements E.locations

15 days ago | 0

| accepted

Answered
Importing data from csv file and my time data is being ruined changes from 24 hour time to 59 hour. How do I fix?
"I tried to export with format 'mm/dd/yyyy HH:mm:ss.SSS a', " Months are MM, minutes are mm: https://www.mathworks.com/help/ma...

15 days ago | 0

Answered
Not able to store an Array field from a Structure to another variable
M = vertcat(F1.Position) or C = {F1.Position} https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html h...

16 days ago | 0

Answered
How to combine elements from cell?
a = {10,11;12,13} b = {20,21;22,23} c = cellfun(@horzcat,a,b, 'uni',0)

18 days ago | 0

| accepted

Answered
How do I assign a value to a field in a multi-level struct when the field name is contained in a variable?
You do not need any obfuscated fiddling around with SUBSASGN(). The standard MATLAB approach is to use SETFIELD() / GETFIELD():...

20 days ago | 0

Answered
How to divide a column in table to other variables?
You need to specify the "GROUPINGVARIABLE" option, otherwise "...unstack treats the remaining variables as grouping variables. E...

20 days ago | 0

| accepted

Answered
Convert multiple strings in a table to numbers
T = cell2table({"cat","1.2","","3.4";"in","4.5","6","7";"hat","","89",""}) T = convertvars(T,2:4,'double')

21 days ago | 0

| accepted

Answered
How to create a time vector that is incremented between two datetime strings?
"But my t outputs only a single time rather than an vector. How can I resolve this?" Of course you can use the COLON operator (...

22 days ago | 0

Answered
Save numbers (present within a cell) into a single matrix
S = load('example.mat'); C = S.example C(cellfun(@isempty,C)) = {0}; M = cell2mat(C)

23 days ago | 0

| accepted

Answered
Multiply Constant Array by Another Cell Array
A = {(1:3).';(-1:2).'}; B = [2,3]; C = cellfun(@times,A,num2cell(B(:)), 'uni',0) C{:}

24 days ago | 1

| accepted

Answered
Combine different size matrix
Works for any data sets, you just need to specify the column/row order of the matrices: C = {[1,1,1;1,1,1;1,1,1];[2,2,2;2,2,2];...

24 days ago | 2

| accepted

Answered
How to extract Datetime string to separate columns of yyyy dd mm hh mm
That is a very unfortunate date format. Best avoided. T = readtable('ararat.txt', 'Format','%{yyyyddMMHHmm}D%f'); % ugh. T.Pro...

24 days ago | 2

| accepted

Answered
Initialising tabular data structure using struct()
A simple REPMAT does the job: M = zeros(nL,mL); data = repmat(struct('at',M, 'bt',M, 'pt',M), NL,ML);

27 days ago | 0

Answered
Table referencing using cell
The simple MATLAB approach is to use the JOIN() family: data = table({'a';'b';'c';'c';'a';'b';'b'}, [3;4;6;8;3;5;4],'VariableNa...

27 days ago | 0

Answered
How to add zeros in cell of string
The MATLAB approach: C = {'10';'00';'11';'011';'0101';'0100'} D = compose('%-08s',string(C))

30 days ago | 0

Answered
Subscript indices must either be real positive integers or logicals
You have created a variable in the workspace named MAX. You need to CLEAR that variable from the workspace, then try again.

30 days ago | 1

| accepted

Answered
Load data with .SPC extensions and certain name characteristics
S = dir('*abc.spc') then loop over the filenames as usual: https://www.mathworks.com/help/matlab/import_export/process-a-seque...

1 month ago | 0

Answered
Converting cell in double
Simpler and more efficient: S = load('ids.mat'); ids = S.ids Method one: robust indexing: X = cellfun(@isscalar,ids); V = z...

1 month ago | 0

Answered
Can I make readtable to be of single precision for numeric values?
"┬┐is there a way for me to make numeric variables/numeric input of readtable to be of single precison?" Two approaches to speci...

1 month ago | 1

| accepted

Answered
Functional programming: looking to create functions that map f(p1,p2,p3,...,pN,x) to g([p1 p2 p3 ... pN],x) and the reverse
Here are two wrapper functions: fpx_to_fpnx = @(fnh) @(varargin) fnh([varargin{1:end-1}],varargin{end}); fpnx_to_fpx = @(fnh) ...

1 month ago | 0

| accepted

Answered
how can I plot in a such a way the x axis is in interval 10 10E2 10E3 10E4.
Use SEMILOGX: Y = [0.266,0.267,0.280,0.340]; X = [1e1,1e2,1e3,1e4]; semilogx(X,Y)

1 month ago | 0

| accepted

Answered
How do I remove quotes from all values in a CSV data?
T = readtable('spam.csv')

1 month ago | 0

Answered
result in table format or excel format
cmdout = fileread('cmdout.txt') % fake data hdr = regexp(cmdout,'^\s*(\S+\s\S+)\s+(\S+)\s+(\S+)\s+(.*)','tokens','once'); tkn ...

1 month ago | 0

| accepted

Load more