Answered
How to remove space after using num2str?
V = [1798.4;1798.6;1798.8;1799;1799.2;1799.4;1799.6;1799.8] S = string(V)

4 years ago | 0

| accepted

Answered
Overwrite table data with 'Yes' or 'No' according to the logical index
Simpler: S = load('sample1.mat'); T = S.sampleinput X = strcmpi(T.TEST_ITEM1,'TV'); T.TEST_LOAD1(:) = {'No'}; T.TEST_LOAD1(...

4 years ago | 0

Answered
how to query string exactly in matlab
C = readcell('TEST.xlsx') X = matches(C,'M2') or X = strcmp(C,'M2') TIP for the future: scroll to the bottom of the CONTAINS...

4 years ago | 0

| accepted

Answered
How to index the matrix only the first dimension of the rest
This will be quite efficient because none of the data in memory is moved around, only the array header is accessed. It also wor...

4 years ago | 1

Answered
compare 1X6 cell data with Structure
It is unclear from your question, if both MatFiles structures are one and the same, or are different. Note that your approach d...

4 years ago | 0

Answered
How to print multiple Values using sprintf In matlab
Rather than hard-coding a fixed number of values to print, I recommend writing more robust code using STRING &JOIN or COMPOSE or...

4 years ago | 0

| accepted

Answered
How to sort the files obtained by ImageDatastore?
A very neat and simple approach (from an answer by Pranay Koppula here) is to apply NATSORTFILES() to the FILES property of the ...

4 years ago | 1

Answered
How to extract a string before a number?
The simple approach using REGEXP, without wasting time fiddling around with indices: str = 'abcd-xyzw-1.2.3.zip'; sub = regexp...

4 years ago | 0

Answered
How do I search for and assign variables within my filespace?
Once those differently-named variables are in the workspace then you are really up the creek without a paddle. Fiddling around w...

4 years ago | 0

Answered
How to separate alternate elements from an array?
A = [1,2,3,4,5,6,7,8]; X = A(1:2:end) Y = A(2:2:end)

4 years ago | 0

| accepted

Answered
Looping through different structures?
You did not tell us if those structures are all saved in one MAT file, or each separately in their own MAT files. That would cha...

4 years ago | 1

| accepted

Answered
How do i count numbers ending in 3
Simple, efficient, basic mathematics: x = [234,352,298,213,365,321,293,213]; n = nnz(mod(x,10)==3)

4 years ago | 0

Answered
search for a folder from a different directory
Using CD is slow and makes code harder to debug. The efficient approach is to use absolute/relative filenames. The best approac...

4 years ago | 0

Answered
How to remove additional comma from string?
tdat = ["t1,t2,t3"; "d2,d3,d4,"] tdat = regexprep(tdat,',+$','')

4 years ago | 0

| accepted

Answered
Weird-Confusing mistake in subtraction result!!!!
"Weird-Confusing mistake" Not weird, not a mistake, but perhaps confusing to the uninitiated. "please help me with this proble...

4 years ago | 1

| accepted

Answered
remove unwanted columns and raws
X1(1,:) = [] X1(:,1) = []

4 years ago | 0

Answered
Identify duplicates in a matrix and keep the one with minimum value
Simple and efficient MATLAB approach using UNIQUE and ACCUMARRAY: A = [1500,12,1; 1500,10,2; 1500,11,3; 1500,15.61,6; 1500,17,5...

4 years ago | 1

Answered
using accumarray to combine text
T = table([1;2;2;3;4;2], ["a";"b";"c";"d";"e";"f"], 'VariableNames',{'EBID','Name'}) G = findgroups(T.EBID); F = @(s)join(s,"|...

4 years ago | 0

| accepted

Answered
Read in text values from CSV file into matrix
READCELL

4 years ago | 0

| accepted

Answered
Merge .mat file to one .mat files
Robust and efficient approach which works for any number of .mat files (unlike the verbose solution you found). Note that any du...

4 years ago | 0

| accepted

Answered
How to take average of such an array?
Z = {[1,0,2,2,1,1,3,1,1,0],[2,1,0,0,0,1,0,2,0,0];[2,2,3,3,1,3,3,2,1,0],[2,2,0,0,1,2,0,2,0,0];[2,3,3,3,2,3,4,2,1,0],[3,5,0,0,1,3...

4 years ago | 0

| accepted

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...

4 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...

4 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...

4 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...

4 years ago | 1

| accepted

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

4 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...

4 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,'...

4 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))

4 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...

4 years ago | 0

| accepted

Load more