Answered
when using intersect function i need all rows of B and matching rows of A. how can i do it?
T1 = array2table([2451,10;2554,5;5419,2],'VariableNames',{'A','id'}) T2 = array2table([2451,15;2554,7;5419,5;8542,9],'VariableN...

4 years ago | 0

| accepted

Answered
Subtracting in a structure
You can do all of them at once using some comma-separated lists: S(1).F = 6; S(2).F = 10; S(3).F = 12; S(4).F = 16; S(5).F ...

4 years ago | 0

Answered
Index table with cell array
Where T is your table and C is your cell array: idx = ismember(T.NameOfVariable, C) out = T(idx,:)

4 years ago | 0

| accepted

Answered
Paste array a into array c based on the locations in array b
This is robust also when there is no overlap: a = [1,2,3,4,5,6]; b = [1,5,8,14,19,23]; d = diff(b); d(end) = d(end)+1; % inc...

4 years ago | 0

| accepted

Answered
How to exclude specific results from dir
C = {'A1b1';'A1b2';'A1b1_test'}; cellfun(@mkdir,C) S = dir('./*'); S.name S(ismember({S.name},{'.','..'})) = []; S(endsWith...

4 years ago | 0

Answered
I am getting a Error using alpha (line 68) Wrong number of arguments and was wondering if anyone could help me out because i am not sure what its saying.
% alpha in degree <<<<<< This needs to be a comment, not code. range=0:15:360; Y=sind(range); Table=[range;Y]'; disp('HW #6 ...

4 years ago | 0

Answered
How to get an specific element from an output vector of a function handle?
You could define a simple wrapper function, e.g.: f = @(x) [x+1; x^2; 2*x]; g = @(a,x)a(x); g(f(1),2)

4 years ago | 2

| accepted

Answered
Error using datenum (line 201) DATENUM failed.
Do not use outdated, discouraged, deprecated DATENUM (or for that matter DATEVEC or DATESTR). Import your data using READTABLE,...

4 years ago | 1

Answered
Trying to write a function using @
g = @(x) sin(x)/x; % ^ ^ you forgot these g(1) g(pi) See: https://www.mathworks.com/help/matlab/matlab_prog/anonymous-fun...

4 years ago | 2

| accepted

Answered
The assignment cannot be performed because the size of the left side is 1×1 and the size of the right side is 0×0.
"But I do not know where is wrong" The problem is caused by using GLOBAL variables instead of parameterizing the function prope...

4 years ago | 0

| accepted

Answered
how do I know which toolboxes are installed?
"...an easy way to see which toolboxes are already installed into a windows workstation" " We would like to get this informatio...

4 years ago | 0

| accepted

Answered
Getting an error For colon operator with char operands, first and last operands must be char.
This line j=('Input number of crossings =') should be j = input('number of crossings =')

4 years ago | 0

Answered
Not enough input arguements in a function
The Events function is defined to have only two input arguments (not three like COND): https://www.mathworks.com/help/matlab/re...

4 years ago | 0

Answered
Matlab does not calculate
Just change the FORMAT, e.g.: format short G T = 0:5:100; V = (1.458.*10.^-6).*((T+273.15).^0.5)./(1+(110.4./(T+273.15))); [...

4 years ago | 0

Answered
Unrecognized function or variable
Unrecognized function or variable 'lenght'. % ^^ spelling mistake

4 years ago | 1

| accepted

Answered
Assign double array to cell array
n = 78; v = rand(n,1) % double array Either: x = num2cell(v) or: x = cell(n,1); x(:) = num2cell(v) Storing numeric scalar...

4 years ago | 0

| accepted

Answered
How to extract vectors from strings
>> A = 'REAL 1.001 2.801 4.378 6.283 7.941 10.774 12.436 14.760 16.205 17.577 1...

4 years ago | 0

| accepted

Answered
how to take every row in matrix?
You could use MAT2CELL, just generate the sizes based on your matrix dimensions and requirements: A = randi(10,10,10) C = mat2...

4 years ago | 0

| accepted

Answered
How to recursively reduce the function arguments
It can be done with VARARGIN: N = 5; C = cell(1,N); C{N} = @f5; for k = N-1:-1:1 C{k} = @(varargin) C{k+1}(varargin{:},...

4 years ago | 1

| accepted

Answered
Adding extension to fille
Simpler: P = 'Data'; S = dir(fullfile(P,'**','*')); S = S(~[S.isdir]); for k = 1:numel(S) F = fullfile(S(k).folder,S(k)...

4 years ago | 0

| accepted

Answered
Find index in struct field in which word appears
"How do I find the row in which this appears in the attached struct in which the subjects are listed in the field 'Subject'?" Y...

4 years ago | 0

Answered
How to convert Data from 'yyyyMMddhhmm' format to datetime format
"... HS_date is a matrix of 1x52561 double values, the data is from 202201010000 to 202301010000." Abuse of decimal numbers to ...

4 years ago | 0

| accepted

Answered
Removing files that match a pattern from files that are on local PC
Assuming that no filenames are substrings of other filenames (e.g. all have the same number of characters): P = 'C:\Users\jorri...

4 years ago | 0

| accepted

Answered
Could anyone please help me to solve the issue in the following command line.
M = reshape(randperm(10),5,2)

4 years ago | 0

| accepted

Answered
How to duplicate rows of a matrix if the number of copies for each row are different?
out = repelem(A,b,1)

4 years ago | 0

| accepted

Answered
What is the use of "maxidx = max(A(:))+1" in the below code ? How does it work? Any alternate syntax for the below function?
"Can someone explain the use of "maxidx = max(A(:))+1;" in this code" The answer can be derived from https://www.mathworks.com/...

4 years ago | 0

| accepted

Answered
Keeping track of order of rows when sorting a matrix
"Or other than this is there any better method? " The MATLAB approach is to get the second output from SORTROWS, which is the s...

4 years ago | 1

| accepted

Answered
How can I get multiple values from arrayfun?
"However, I want to get 21000 double instead of 11000 cells. Is there any way I can get x1 as 2*1000?" Of course, just use a co...

4 years ago | 1

| accepted

Answered
Alternative to 'evalin' for pdepe solver
"Does anyone have a suggestion on how I can pass my 5 arguments into the pde function?" The recommended, documented, efficient ...

4 years ago | 0

| accepted

Answered
To add two datetime arrays , with millisecond values
You should be storing those times as duration objects (not as datetime objects) so you could simply add them. The solution to yo...

4 years ago | 0

| accepted

Load more