Answered

Condense code in Split string operation

s = "xxx_yyy_zzz.xlsx"; regexp(s,'[^_.]+(?=\.)','match','once')

Condense code in Split string operation

s = "xxx_yyy_zzz.xlsx"; regexp(s,'[^_.]+(?=\.)','match','once')

20 Tage ago | 1

| accepted

Answered

My matlab code with interp3 is not providing me correct answer. Please help.

format compact T = readtable('interpcheck.csv') A = accumarray([T.x,T.y,T.z],T.result) X = unique(T.x); Y = unique(T.y); Z ...

My matlab code with interp3 is not providing me correct answer. Please help.

format compact T = readtable('interpcheck.csv') A = accumarray([T.x,T.y,T.z],T.result) X = unique(T.x); Y = unique(T.y); Z ...

20 Tage ago | 0

| accepted

Answered

Where is the Documentation for Indexing on the Left Hand Side of an Assignment?

Here: https://blogs.mathworks.com/loren/2020/01/31/repeated-indexing-in-matlab/ https://blogs.mathworks.com/loren/2007/07/26/as...

Where is the Documentation for Indexing on the Left Hand Side of an Assignment?

Here: https://blogs.mathworks.com/loren/2020/01/31/repeated-indexing-in-matlab/ https://blogs.mathworks.com/loren/2007/07/26/as...

21 Tage ago | 1

| accepted

Answered

extract the last value from each cell in array?

The simple MATLAB approach: M = readmatrix('transRewards_40_0.1_2.csv', 'LineEnding',']', 'TrimNonNumeric',true) plot(M(:,20))...

extract the last value from each cell in array?

The simple MATLAB approach: M = readmatrix('transRewards_40_0.1_2.csv', 'LineEnding',']', 'TrimNonNumeric',true) plot(M(:,20))...

23 Tage ago | 0

| accepted

Answered

Questions about the rgb2gray function

"does anyone know why?" The values shown in the documentation are shown only to 3 decimal places. The actual values used for t...

Questions about the rgb2gray function

"does anyone know why?" The values shown in the documentation are shown only to 3 decimal places. The actual values used for t...

23 Tage ago | 0

| accepted

Answered

Replacing values of a vector with values in another vector of a different size

A = [0,0,0,1,1,1,0,0,1,1,0,0,0]; B = [1,2,3,inf,4]; C = double(A); C(A==1) = B; C(isinf(C)) = 0

Replacing values of a vector with values in another vector of a different size

A = [0,0,0,1,1,1,0,0,1,1,0,0,0]; B = [1,2,3,inf,4]; C = double(A); C(A==1) = B; C(isinf(C)) = 0

24 Tage ago | 0

| accepted

Submitted

Convert between RGB and Color Names

RGB to color name. Color name to RGB. Supports many palettes: CSS, dvips, HTML, MATLAB, RAL, SVG, X11, xcolor, xkcd,...

24 Tage ago | 22 downloads |

Answered

How do I compare two shuffled vectors, and get the indexes of one as it appears in the other?

A = ["cond1","cond2","cond3","cond4"]; b = ["cond4","cond2","cond1","cond3"]; [~,X] = ismember(A,b)

How do I compare two shuffled vectors, and get the indexes of one as it appears in the other?

A = ["cond1","cond2","cond3","cond4"]; b = ["cond4","cond2","cond1","cond3"]; [~,X] = ismember(A,b)

24 Tage ago | 1

| accepted

Answered

Problem with accessing struct in a struct

"Why didnt my idea work out accessing the variable/array in the struct in the struct by using the command oe_sum.a.A for example...

Problem with accessing struct in a struct

"Why didnt my idea work out accessing the variable/array in the struct in the struct by using the command oe_sum.a.A for example...

25 Tage ago | 0

| accepted

Answered

Improve speed of execution by pre allocation of array

"How preallocation could be done in this and similar case?" In that and similar cases the MATLAB approach would be to simply as...

Improve speed of execution by pre allocation of array

"How preallocation could be done in this and similar case?" In that and similar cases the MATLAB approach would be to simply as...

25 Tage ago | 0

| accepted

Answered

Converting rough strings to exact strings

S = [... "textIdontCareAbout_Phenolic32_Group5_textIdontCareAbout" "textIdontCareAbout_P1_textIdontCareAbout" "te...

Converting rough strings to exact strings

S = [... "textIdontCareAbout_Phenolic32_Group5_textIdontCareAbout" "textIdontCareAbout_P1_textIdontCareAbout" "te...

25 Tage ago | 0

| accepted

Answered

Replacing Arrays and Matrices

"Is it a good idea to overwrite an array with matrix?" There is no difference: MATLAB does not have a "matrix" class: all numer...

Replacing Arrays and Matrices

"Is it a good idea to overwrite an array with matrix?" There is no difference: MATLAB does not have a "matrix" class: all numer...

26 Tage ago | 1

Answered

How to make a m*2 matrix into n number of 2x2 matrices

A = rand(208,2); C = mat2cell(A,2*ones(104,1),2)

How to make a m*2 matrix into n number of 2x2 matrices

A = rand(208,2); C = mat2cell(A,2*ones(104,1),2)

26 Tage ago | 0

| accepted

Answered

Cell array with space between the ' and }

"the only strange thing about the cell array is that the {'15.0' } has a space after the ' and before the }." It is not strang...

Cell array with space between the ' and }

"the only strange thing about the cell array is that the {'15.0' } has a space after the ' and before the }." It is not strang...

28 Tage ago | 0

Answered

How to rearrange columns in a MATRIX?

x = [1,2,4,4,5,6; 3,4,6,6,7,8; 3,4,5,6,6,7; 4,5,6,8,7,8] y = reshape(permute(reshape(x,size(x,1),2,[]),[1,3,2]),[],2)

How to rearrange columns in a MATRIX?

x = [1,2,4,4,5,6; 3,4,6,6,7,8; 3,4,5,6,6,7; 4,5,6,8,7,8] y = reshape(permute(reshape(x,size(x,1),2,[]),[1,3,2]),[],2)

29 Tage ago | 1

Answered

How to read and use folder name from Address Path?

SelMatPathOld = 'D:\ninn\2_resimResult_0628\20220330'; [~,sub] = fileparts(SelMatPathOld) old = fullfile('.',"ComapareSummary"...

How to read and use folder name from Address Path?

SelMatPathOld = 'D:\ninn\2_resimResult_0628\20220330'; [~,sub] = fileparts(SelMatPathOld) old = fullfile('.',"ComapareSummary"...

29 Tage ago | 0

| accepted

Answered

Using a loop to load multiple mat files from measurement into the workspace

https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html P = '.'; % absolute or relative path to wh...

Using a loop to load multiple mat files from measurement into the workspace

https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html P = '.'; % absolute or relative path to wh...

29 Tage ago | 1

Answered

How do I load multiple .mat files and save them as variables?

https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html P = '.'; % absolute or relative path to wh...

How do I load multiple .mat files and save them as variables?

https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html P = '.'; % absolute or relative path to wh...

etwa ein Monat ago | 0

Answered

To extract the last sub string from strings

Avoid slow CELLFUN, STR2NUM, REGEXP, etc. One SSCANF call is probably the most efficient approach by far, as well as being very...

To extract the last sub string from strings

Avoid slow CELLFUN, STR2NUM, REGEXP, etc. One SSCANF call is probably the most efficient approach by far, as well as being very...

etwa ein Monat ago | 2

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)

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)

etwa ein Monat 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(...

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

etwa ein Monat 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...

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

etwa ein Monat 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...

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

etwa ein Monat 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...

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

etwa ein Monat 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...

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

etwa ein Monat 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 IM...

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

etwa ein Monat ago | 0

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_str = re...

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_str = re...

etwa ein Monat 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...

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

etwa ein Monat 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)

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)

etwa ein Monat 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...

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

etwa ein Monat ago | 1

| accepted