How to converting complex numbers to absolute values?
No need for slow fiddling around with imported text via CELLFUN or evil EVAL. Just specify the delimiter&whitespace and MATLAB ...

ongeveer een maand ago | 0

| accepted

assign cell arrays to struct
You could use CELL2STRUCT : fnm = {'hello','world'}; val = {[1,NaN],[1,4,9]}; S2 = cell2struct(val,fnm,2) or a comma-separat...

ongeveer een maand ago | 0

| accepted

how to find indices of duplicates in array and save results on a structure
A = [1;5;2;5;3;3;4;1;2;1]; [U,~,X] = unique(A); V = 1:numel(A); C = accumarray(X,V(:),[],@(v){v}); S = struct('value',num2ce...

ongeveer een maand ago | 0

| accepted

Logical indexing cell array
That is an inefficient way to store and process that data. Using one numeric array would be simpler and much more efficient: M...

ongeveer een maand ago | 1

Can you download individual images from the image labeling app onto an external hard drive?
"but I can't figure out a way to set the hard drive as the folder I want to save my images in" Don't. Do not set/change to oth...

ongeveer een maand ago | 0

Help iteration for loop and tables vertcat
Using one cell array will be much simpler (and more efficient) than your approach of numbering the variable names: w = 1:10; % ...

ongeveer een maand ago | 1

| accepted

Splitting table text column with multiple delimiters based on parantheses.
S = ["Player collected a YELLOW coin at (-5.5, 10.9, 90.1)";"Access to new world";"New world entered";"Player collected a GREEN ...

ongeveer een maand ago | 1

| accepted

How to store multiple output tables in a cell array
With MATLAB it is easier and more versatile to loop over indices, rather than looping over data. This makes it easy to prealloca...

ongeveer een maand ago | 0

| accepted

How can I separate the elements of a vector ?
for jj = i(diff(i)~=0) or for jj = unique(i,'stable')

ongeveer een maand ago | 0

| accepted

multiplication by taking into account the values when creating a matrix
A = [2,1,4,3;10,15,20,10;20,10,15,20] B = [1,3,4;4,5,6;2,1,4;3,5,1] C = [50;100;25;10] lkp = [10,15,20]; idx = A(1,:); [~,i...

ongeveer een maand ago | 1

| accepted

How to read floating point number 5.3246-5 as 5.3246E-5 in text file
str = '9.4345-51.8998772.518305'; tmp = cellstr(reshape(str,8,[]).'); tmp = regexprep(tmp,'(?<=\d)([-+]\d+)\$','E\$1') vec = st...

ongeveer een maand ago | 0

How to make a two-dimensional mask act on a three-dimensional array?
"I wondered if there was any neat trick to do it by array multipication..." A = 9* ones (6,4,3); % create a 3 dimensional array...

ongeveer een maand ago | 0

How to create a matrix with special block diagonal structure
N = 8; C = arrayfun(@ones,1:N,'uni',0); B = tril(blkdiag(C{:})); spy(B)

ongeveer een maand ago | 0

Remove text from CSV data
str = readlines('20220427T131641-2d.csv'); idx = startsWith(str,digitsPattern); writelines(str(idx),'new.csv') Checking: typ...

ongeveer een maand ago | 0

| accepted

How can I get my function that calculates distance between data and user input with sort data and closest data set from file
V = [2,5,7]; M = readmatrix('somedata.xlsx') D = vecnorm(M-V,2,2) [X,Y] = mink(D,2) Z = M(Y,:)

ongeveer een maand ago | 0

| accepted

In a 6x6 square matrix A, how to select elements in i-th row with A(i,j) ruled out
A = [0,0,-1,1;1,1,0,0;0,0,1,0;1,-1,0,1] B = +diag(diag(A) & ~any(A-eye(size(A)),2))

ongeveer een maand ago | 0

convert lower case to upper and upper to lower
str = '123 Hello World!'; str = regexprep(str,'[A-Za-z]+','\${char(mod(\$&-97,64)+65)}')

ongeveer een maand ago | 0

How can we convert a number into a string value with the exact number of digits present in the number?
sprintf('%.15g',0.0199155) sprintf('%.15g',0.01991556789) sprintf('%.15g',23456.7891234)

ongeveer een maand ago | 0

| accepted

find first& end of array
S = [0,1,5,2,0,0,0,9,3,50,53,0,0,5,7,4] X = diff([0;S(:)]==0)<0 | diff([S(:);0]==0)>0; V = S(X)

ongeveer een maand ago | 0

| accepted

separating numbers in cells
Assuming that you have a cell array of character vectors: C = {'1-8','7-1','8-4';'4-6','8-5','7-3'} D = split(C,'-'); A = str...

ongeveer een maand ago | 0

| accepted

How to find the index of the first absolute minimum entry of a matrix
A = [5,7,0.5,5;2,0.5,4,1;0.5,6,7,9]; [V,X] = min(A.',[],'all'); [C,R] = ind2sub(size(A),X)

ongeveer een maand ago | 0

"I have created two .dat files using a same perl script, but on different machines." And they have created different files. "C...

ongeveer een maand ago | 0

TUTORIAL: Comma-Separated Lists and How to Use Them
A common misunderstanding of comma-separated lists involves nested structures. The expectation is that dot-indexing at arbitrary...

ongeveer een maand ago | 0

Evaluating a function with Matlab
"Can anyone help me figure out why I am getting an imaginary number in the following code:" Because you are taking the power of...

ongeveer een maand ago | 0

| accepted

storing excel data in matrix using for loop
n = 4; A = zeros(n,20); F = 'filename.xyz'; for y = 1:n S = sprintf('sheetname_%d',y); A(y,:) = readmatrix(F, 'Shee...

ongeveer 2 maanden ago | 0

| accepted

Create new matrices based on the number of unique values
Those three matrices are a red-herring. M = [4,7,2;2,4,7;2,2,4] [U,~,X] = unique(M(:)); S = accumarray(X,M(:)) [~,Y] = max(S...

ongeveer 2 maanden ago | 1

| accepted

sum a column in a matrix
F = @(t) sum(t{:,7}); V = cellfun(F,Tables)

ongeveer 2 maanden ago | 1

| accepted

How can I avoid using addpath to read files outside Matlab's search folder?
" Is it correct that before files can be read by Matlab, the folder where files are located have to be added to Matlab's search ...

ongeveer 2 maanden ago | 0

| accepted