Answered
Multiplication between two matrices with different number of rows
C = permute(A,[1,3,2]) .* reshape(B,1,[])

4 years ago | 0

| accepted

Answered
Using regular expressions to recognize pattern based on multiple lines
str = fileread('dogbone_raise3D.txt') out = regexp(str,'(?<=;TYPE:SOLID-FILL\s+;WIDTH:\S+\s*\n\s*)[^;]+','match') out{:} Note...

4 years ago | 1

| accepted

Answered
Averaging elements for a cell within a cell array
Where C is your cell array: V = mean([C{:}],2) https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html h...

4 years ago | 0

| accepted

Answered
find 'last' function not working
"Any ideas on why this happens?" Yes. "Could it be a bug or am I doing a logical error? " You are doing several logical error...

4 years ago | 1

| accepted

Answered
Help needed with regular expressions
Do not learn from this regular expression. % [G]\-{0,1}\d{1,}\.*\d* % ^^^ match literal 'G' once, square b...

4 years ago | 1

Answered
How to sum 3D matrix along 2 and 3 dimention
B = ones(20,10,10); V = sum(B,2:3)

4 years ago | 0

| accepted

Answered
Perform mldivide between 3x3 matrix M and every RGB pixel in a image in GPU
format compact S = 5; M = rand(3,3); I = rand(S,S,3); % reference: A = nan(S,S,3); for ii = 1:S for jj = 1:S ...

4 years ago | 0

| accepted

Answered
Error in concatination in binary values
V = [8,14,10,9,6,3,2,7,6,11,6,3,13,15,6,0]; N = bin2dec(reshape(dec2bin(V,4).',8,[]).')

4 years ago | 0

| accepted

Answered
How do I grab all the files with a certain name pattern from several folders?
All_files -> Folder1 -> no1 -> grab1 -> Folder2 -> no2 -> grab2 ...

4 years ago | 1

Answered
Epoch time conversion using datetime function
Your value is in milliseconds (not seconds, as is standard for Unix time), so either divide the value by 1000: opt = {'Format',...

4 years ago | 0

| accepted

Answered
How to read images sequentially from a folder?
You can download the file NATSORTFILES by clicking the big blue download button here: https://www.mathworks.com/matlabcentral/f...

4 years ago | 1

| accepted

Answered
Given a long (50-2000 each set in scientific notation ex. +1.394013E-10) string of multiple numbers, how can I convert it to an array quickly.
The very efficient approach is to use SSCANF: str = "+1.362134E-10,+1.381140E-10,+1.397078E-10,+1.401982E-10,+1.400756E-10,+1.4...

4 years ago | 0

| accepted

Answered
textscan to read date and time column and numeric data together
T = readtable('WHP-SEA-TP116-HS417-S1.csv', 'NumHeaderLines',66)

4 years ago | 0

| accepted

Answered
Create Structure from cell array with dot separation in string
You can use SETFIELD() with a comma-separated list: V = pi; T = 'em1500.eta_t.x'; C = split(T,'.'); S = struct(); S = setfi...

4 years ago | 0

| accepted

Answered
file list when "dir" to import data
"How can I make the "liste" to have the sequentially increasing number in the name?" If you cannot change the filenames to use ...

4 years ago | 0

| accepted

Answered
How do i get multiple values all at once from cell array?
"... for loop(cause they are slow)" A well-written loop will be fast enough, e.g. where C is your cell array and assuming that ...

4 years ago | 0

Answered
converting csv timestamp to datetime on import
type test.csv T = readtable('test.csv','Format','%{M/d/y}D%T%d','Delimiter',{',',' '}) D = T.Var1 + T.Var2 + milliseconds(T.Va...

4 years ago | 0

| accepted

Answered
how to do the addition of the cell matrix ?
The simple and efficient MATLAB approach is to use SUM(): val = cat(3,[0,67.5000,0,67.5000,0;0,67.5000,0,67.5000,0],[79.3333,0,...

4 years ago | 0

| accepted

Answered
Strange behaviour: struct with cell values
"Strange behaviour: struct with cell values" The STRUCT() documentation explains what happens with cell array inputs: "... if v...

4 years ago | 0

| accepted

Answered
Sorting table row variables with number and letters
Your question and examples are confusing: sometimes you show that you want to sort RowNames, and sometimes that you want to sort...

4 years ago | 1

Answered
Sort according to specific string contained in file name
S = ["D:\DATA\XY\Project_XY\label_sPR12345_AB67890-0011.nii"; "D:\DATA\XY\Project_XY\label_sPR40922_AB03091-0011.nii"; ...

4 years ago | 0

Answered
Why am i getting this error 'unrecognized function or variable' for the defined function itself
clc % <---------- !!!!!!!!!!!!!!!!!! DELETE THIS LINE !!!!!!!!!!!!!!!! % <- and this line too function MM = po(conc,p,k) ...

4 years ago | 1

Answered
How could I program a "for loop" in Matlab to calculate the function's minimum value?
X = [1,2,3,4,5]; Y = nan(size(X)); for k = 1:numel(X) b = X(k); G = @(x) x.^2 - b.*x + 1; Y(k) = fminbnd(G,0,10...

4 years ago | 1

Answered
How to use "contains" statement to detect a string without ambiguity?
"Can you help me to solve this issue?" CONTAINS() check if the pattern occurs anywhere inside the string, but this could be a s...

4 years ago | 0

| accepted

Answered
How to round numbers to specific near point?
A = [6.1;6.04;5.98;5.92;5.86;5.8;5.74;5.69;5.63;5.57;5.52;5.46;5.41] N = 0.05; B = round(A/N)*N

4 years ago | 0

| accepted

Answered
What is the orthodox precedure of evaluating/determining the type of a distribution? And How to fit it into a normal distribution with skewness and kurtosis?
The standard appraoch is to use a quantile-quantile plot: https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot which you can do in M...

4 years ago | 0

Answered
Results of math with integer
"I tought using integer math tells that if we woukd result in a non integer result, the non integer part gets truncated:" What ...

4 years ago | 0

| accepted

Answered
Multiple outputs from a for loop
Rather than distracting with anti-pattern numbered variables (like you asked about), instead you should just use basic, normal, ...

4 years ago | 0

| accepted

Answered
Cell2mat with different rows
Download https://www.mathworks.com/matlabcentral/fileexchange/22909-padcat and use it like this: S = load('Cell.mat') A = S.A ...

4 years ago | 1

| accepted

Answered
How to change each column of data in a matrix into a comma expression in an elegant and efficient way?
" I want to directly convert the above matrix A to table type" ARRAY2TABLE() "I can't find a function in matlab that can conve...

4 years ago | 0

| accepted

Load more