Answered
Why does not string(f.name) work, f = dir(folder)?
"Why does not string(f.name) work, f = dir(folder)?" Dot indexing into the structure f f.name generates a comma-separated lis...

3 years ago | 1

| accepted

Answered
Extracting and saving frames from a video with automatic number '0001,0002,0003' instead of 1,2,3 etc
V = VideoReader("Video1.mp4"); for k = 1:V.NumFrames A = readFrame(V); F = sprintf('%05d.jpg',k); imwrite(A,full...

3 years ago | 0

| accepted

Answered
Number of .mat files into single .mat file
Fake data: X = 1:3; save data1.mat X X = 4:6; save data2.mat X X = 7:9; save data3.mat X clear Joining file data: N = 3...

3 years ago | 0

Answered
Delete duplicate cell in a cell of complex double.
As far as I can tell, you only want to remove local duplicate (i.e. only checking within the same cell of F): F = {{[0.04,0.2,0...

3 years ago | 1

| accepted

Answered
Extract the Transport names from the list of adapter names
Oneliner :) txt = 'Physical Address Transport Name =================== =====...

3 years ago | 1

Answered
Can I parse a text file with dates and data using readmatrix or readtable?
"but I don't know how to specify the datetime in the call. I don't understand the matlab instructions for these." READTABLE, RE...

3 years ago | 0

Answered
How to find text structure within string array?
str = "moose_0_-1_6_Coordinates-8580_138864_ 30-01-21_17-48-22_0.xml"; rgx = '\d+-\d+-\d+_\d+-\d+-\d+'; out = regexp(str,rgx,'...

3 years ago | 0

| accepted

Answered
Extract fields from structure
A.C.XX_YY1 = 5; A.C.XX_YY2 = 10; A.C.ZZ = 3; B = A.C; F = fieldnames(B); X = startsWith(F,'XX_YY'); B = rmfield(B,F(~X))

3 years ago | 0

| accepted

Answered
Copying and renaming multiple files from multiple directories into one directory
This should get you started: P = 'absolute or relative path to the source parent directory'; Q = 'absolute or relative path to...

3 years ago | 0

| accepted

Answered
How to avoid "NaT" when converting a cell into datetime ? (Or: how to add missing parts of datetime ?)
"How to avoid "NaT" when converting a cell into datetime ?" Convert each cell individually. Certainly not as efficient as one D...

3 years ago | 0

| accepted

Answered
how to prealloacte and store values in a character array?
I am guessing that your strings have different lengths on different loop iterations, in which case it mght not be obvious how to...

3 years ago | 0

Answered
How to find out number of Fridays in a month?
Here is a really simple approach using CALENDAR(): M = calendar(2022,8); N = nnz(M(:,6)) Otherwise you could try using a DATE...

3 years ago | 0

Answered
How do I copy some files to another folder?
"I guess the filename cannot be a string..." The filenames certainly can be string. The problem is the you are using command s...

3 years ago | 0

Answered
How to delete a duplicate cells?
F = {[3,8;6,4],[6,9;7,3],[3,8;6,4],[6,9;7,3]}; F{:} for ii = numel(F):-1:2 for jj = 1:ii-1 if isequal(F{ii},F{jj...

3 years ago | 1

| accepted

Answered
Split string in two strings
str = ["van Donk","Gerritsen","kooijman","Verliefde","Floré","Pengel","aan de Wiel","van der Hoeven","Hop","Boer","van Ewijk"] ...

3 years ago | 1

Answered
Split column by text and numbers
str = ["54","33","104A"]; tkn = regexp(str,'^(\d+)\s*(\w*)$','tokens','once'); tkn = vertcat(tkn{:}); num = tkn(:,1) let = t...

3 years ago | 0

| accepted

Answered
Store cell arrays composed of datetimes and numbers
Your loop works for me (with suitable preallocation): store = cell(5,2); % preallocate! for i = 1:5 dt = datetime(2022,ra...

3 years ago | 0

| accepted

Answered
Unable to use inner join function
Because the two tables use different names for the key variable, you will have to help INNERJOIN by telling it the names of the ...

3 years ago | 0

| accepted

Answered
how to write numbers with 10^ format in matlab?
str = strrep(sprintf('CC = %.1e',123456),'e','x10^') str = regexprep(sprintf('CC = %.1e',123456),'e(\D)0*(\d+)$','x10^$1$2')

3 years ago | 0

| accepted

Answered
How would I convert years to date time?
N = 2022.1765918316; D = datetime(fix(N),1,1) + calyears([0;1]); T = D(1) + diff(D)*mod(N,1)

3 years ago | 0

| accepted

Answered
how to extract some data from this particular structure?
"Any ideas?" Two comma-separated lists will do it. For example, where C is your cell array: S = [C{:}]; % create non-scalar st...

3 years ago | 0

| accepted

Answered
How removing elements from vector?
c = [1,2,3] z = [10,9,1,4,11,2,6,3] x = setdiff(z,c,'stable') or z(ismember(z,c)) = []

3 years ago | 0

| accepted

Answered
How to convert negative numbers in parentheses (bank-formatted text) to numbers with minus sign?
S = ["(1,234)";"2,345,678";missing;"(1,234.56)"] N = str2double(strrep(strrep(S,')',''),'(','-'))

3 years ago | 1

Answered
Create a cell with row vectors as elements
F = @(varargin) vertcat(varargin{:}); C = arrayfun(F, A,B,C,D,E,F,G,H,I,J, 'uni',0);

3 years ago | 0

| accepted

Answered
How do I insert a 1x1 cell array consisting of one vector into a table?
So far no one adressed your questions, nor explained the cause of your problem: the problem comes from the fact that you are usi...

3 years ago | 0

| accepted

Answered
How to concatenate multiple .mat files and generate a 3D matrix?
"I have 100 files ..." which are probably named using some sequential numbering, so you will need to take that into account in ...

3 years ago | 0

| accepted

Answered
Can you parameterize table lookup, i.e. t1.A(i) = t2.A(t2.B==t1.B(i)), so it does not require a loop?
If you stored the IDs as basic numeric arrays, rather than inefficiently as complex cell arrays containing lots of numeric scala...

3 years ago | 0

| accepted

Answered
Using structures with Functions
Rather than defining a scalar structure containing arrays, it looks like you should be using a non-scalar structure: https://ww...

3 years ago | 2

| accepted

Answered
Sort files in folder based on type
mkdir('ecfFiles') mkdir('txtFiles') movefile('*.ecf','ecfFiles') movefile('*.txt','txtFiles')

3 years ago | 0

Answered
Infinite loop when decimals are added
"Please explain" Different accumulated floating point error combined with an algorithm that does not take into account the beha...

3 years ago | 0

| accepted

Load more