Answered
how filter "*.*" when using uigetfile function.
If there are no descriptors, the "All files" is automatically appened onto the end of the filter. The solution is to add descrip...

4 years ago | 0

| accepted

Answered
How to subtract ?
The simple MATLAB approach: S = load("allmat.mat"); M = S.allmat M(:,6) = M(1,6)-cumsum(M(:,5))

4 years ago | 0

| accepted

Answered
Creating a table by extracting rows from a table based off their values in relation to another table of a different size.
a = [11;33;55;77;99;23;45;67;89;87;65;43;10;1;3;5]; b = [22;44;66;88;12;34;56;78;98;76;54;32;21;2;4;6]; c = [2;2;2;2;4;4;4;4;6...

4 years ago | 0

Answered
I got wrong data when i use datetime convertfrom
S = load('time.mat'); D = S.time T = datetime(1800,1,1) + hours(D)

4 years ago | 0

| accepted

Answered
How to use the command window in order to make a script faster and interactive?
I had to write a script to carefully remove all of those numbers from the variable names and recreate the original MAT files acc...

4 years ago | 0

| accepted

Answered
Using diff(x) function to create a new table by subtracting values from the previous row
M = readmatrix('Data241.xlsx') [~,idr] = sort(isnan(M),1); [~,idc] = ndgrid(1:size(M,1),1:size(M,2)); A = -diff(M(sub2ind(siz...

4 years ago | 1

| accepted

Answered
Error in datetime array format for writing new matrix
Ah, fractional years. Here is one way to convert a fractional year (yes, even leap years) to datetime: format long G M = readm...

4 years ago | 0

| accepted

Answered
Matlab Vlookup/Indexing equivalent
DT = [datetime(2027,1,1,(0:4).',0,0);datetime(2028,1,1,0,0,0)] Y = year(DT); M = [2027,1.2,200,350;2028,3.7,200,350;2029,7.2,2...

4 years ago | 0

| accepted

Answered
How to interchange position of a matrix?
A = [3,1,2]; B = [2,3,1]; X = [2,1,3]; for k = 1:numel(X) X([A(k),B(k)]) = X([B(k),A(k)]); end X

4 years ago | 1

| accepted

Answered
How can I split string based on a sting array?
S = "alpha{ beta} new {} new2}"; T = ["alpha","beta", "{","}"]; [X,Y] = strsplit(S,T, 'CollapseDelimiters',false); X = strtri...

4 years ago | 0

| accepted

Answered
Variable name from a cell content
You could use a structure to store all of the tables: F = "Input.xlsx"; S = sheetnames(F); D = struct(); for k = 1:numel(S) ...

4 years ago | 0

Answered
Access variables with naming in workspace
This appears to be a follow up from your question from seven hours ago: https://www.mathworks.com/matlabcentral/answers/1804720...

4 years ago | 2

| accepted

Answered
Condense code in Split string operation
s = "xxx_yyy_zzz.xlsx"; regexp(s,'[^_.]+(?=\.)','match','once')

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

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

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

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

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

4 years ago | 0

| accepted

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)

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

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

4 years ago | 0

| accepted

Answered
Converting rough strings to exact strings
S = [... "textIdontCareAbout_Phenolic32_Group5_textIdontCareAbout" "textIdontCareAbout_P1_textIdontCareAbout" "te...

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

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

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

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

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

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

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

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

4 years ago | 2

Load more