Answered
Interpolate Data associated to cartesian meshgrid to all direction (like polar interpolation)
Interpolating in 1D to: give the shape formed by rotation around X=Y=0 correctly return NaN for values outside the data domain...

4 years ago | 0

| accepted

Answered
Readtable gives unusual results reading data from a text file.
T = readtable('20160419-2010.txt','NumHeaderLines',0) T = readtable('20111118-0021.txt','NumHeaderLines',0) T = readtable('200...

4 years ago | 1

| accepted

Answered
How can i assign as an input one entire field of an multiple row struct when call a function ?
particle(1).Cost = [1 1]; particle(2).Cost = [2 2]; particle(3).Cost = [50 50] M = vertcat(particle.Cost) Then simply call y...

4 years ago | 1

| accepted

Answered
Question regarding matrix with NaN.
X = [9,6,9;0,2,nan;3,1,2] tmp = X.'; idx = ~isnan(tmp); cnt = sum(idx,1); M = [repelem(cnt,cnt);tmp(idx).']

4 years ago | 0

Answered
reordering matrix elements according to another matrix
A = [2 ; 4 ; 1 ; 3]; B = [12; 15; 20; 9]; [A,X] = sort(A); % or SORTROWS B = B(X)

4 years ago | 1

Answered
Why does Timer callback experience "too many output arguments" errors?
"But the function has no output... why does this happen?" Yes, it does, it has exactly one output argument. On this line: 'Tim...

4 years ago | 0

| accepted

Answered
A function that replaces any negatives with zeros
Simpler and much more efficient than your approach using indexing: function y = NoNegatives(x) y = max(0,x); end Why use slo...

4 years ago | 1

Answered
how do i print this matrix?
M = repelem([1,1;1,0;0,1],[1,2,3],[3,2])

4 years ago | 0

Answered
Import data into matlab but ignore subject name
P = 'absolute or relative path to where the subfolders are'; S = dir(fullfile(P,'**','*data_matrix.CSV')); for k = 1:numel(S) ...

4 years ago | 0

| accepted

Answered
How can I store the 100 rows of the array in one Matrix?
format compact X = rand(1,3,100) Y = permute(X,[3,2,1])

4 years ago | 1

| accepted

Answered
Extract row values from text file to add
V1 = readmatrix('file1.txt') V2 = readmatrix('file2.txt') Z = cumsum(0.5*(V1(2:end)+V1(1:end-1)) .* diff(V2))

4 years ago | 0

| accepted

Answered
Perform calculations on matrices stored in cells
A = cat(3,C{:}); % join all matrices into one array A(1:3,1,128) - A(1:3,1,:) % difference 1st column A(1:3,2,128) - A(1:3,2,:...

4 years ago | 0

Answered
How do I use fprintf to print a cell in a cell array?
A = {'hi'}; fprintf('%s\n',A{:}); https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-cell-array.html

4 years ago | 0

Answered
Problems with the diff function
syms x y M = 2 * y - 2 * x * y^3 + 4* x + 6 N = 2*x - 3*x^2*y^2 -1 cond = diff(M,y) - diff(N,x) Note: diff(M,y) diff(N,x)

4 years ago | 0

Answered
Fix out-of-gamut RGB colors
Simpler and much more efficient: rawRGB = max(0,min(1,rawRGB));

4 years ago | 0

| accepted

Answered
How to save 14*14 matrix in each iteration?
N = 128; C = cell(1,N); for k = 1:N .. your code C{k} = Vd; end https://www.mathworks.com/help/matlab/matlab_prog/...

4 years ago | 0

| accepted

Answered
Matlab: Convert [2x1 sym] to a numerical value
syms A B C D E = (89*50*sind(170))+(92.3*A*sind(C))+(83.3*B*sind(D))==0; F = (89*50*cosd(170))+(92.3*A*cosd(C))+(83.3*B*cosd(D...

4 years ago | 0

| accepted

Answered
Using xlsread with multiple delimiters
Without a sample XLSX file I had to create my own (attached). It is easy to read the first line using READCELL, it will correct...

4 years ago | 0

| accepted

Answered
Data Arrangement in Matrix form
S = load('matlab.mat') B = reshape(S.A,132,2911)

4 years ago | 0

| accepted

Answered
read csv file with a lot of columns.
A much better approach would use READTABLE to correctly import that numeric data (with decimal-commas in what is actually a semi...

4 years ago | 1

Answered
Read data from .txt with regexp
rgx = '^\s*->\s*(\w+)\s*\[[\w\s]+\]:\s*([^\r\n]+)'; str = fileread('ExampleTextFile.txt'); tkn = regexp(str,rgx,'tokens','line...

4 years ago | 2

| accepted

Answered
Reading files in a specified order
Download NATSORTFILES here: https://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort and use it ...

4 years ago | 0

| accepted

Answered
If condition: "in each row of a matrix one element is zero and the other one is not zero"
A = [1,0;0,9;12,0;0,2;0,3] if any(A,2)&any(~A,2) disp('in each row one element is zero and the other one is not zero') en...

4 years ago | 1

Answered
Extracting strings in a cell array that contain certain characters
W = {'gamer';'macho';'mages';'grail'}; L = 'amg'; X = cellfun(@(w)all(ismember(L,w)),W); Z = W(X)

4 years ago | 0

Answered
char(2713) and fprintf('\x2713\n') don't show a checkmark in the command window
"According to https://en.wikipedia.org/wiki/Check_mark, the unicode for a checkmark is 2713." Sure, lets try it using both FPRI...

4 years ago | 3

| accepted

Answered
How to read this file in MATLAB?
"I guess I will need to convert the file and then read it, but how?" Why do you "guess" that? READTABLE has no problem importin...

4 years ago | 0

Answered
Is it possible to use two textscan statements in a row ?
"Is it possible to use two textscan statements in a row ?" Yes, you can call TEXTSCAN as many times as you want on one file, I ...

4 years ago | 0

| accepted

Answered
How to remove corresponding rows of a second array in the case of NaNs in the first array?
Where M is your matrix (do not use the name mean): idx = all(isnan(M),2); M(idx,:) = []; clst(idx,:) = []; Why do you want t...

4 years ago | 0

| accepted

Answered
Help with Matrix logic and indexing
cnt = nnz(m>= 40 & m<= 50)

4 years ago | 0

Answered
Converting string array to float array
S = ["[1,1]";"[2,1]";"[3,1]"] Method 1: M = sscanf(join(S,''),'[%f,%f]',[2,Inf]).' Method 2: M = cell2mat(arrayfun(@str2num,...

4 years ago | 1

| accepted

Load more