Answered
dialog box imput variables
Use <https://www.mathworks.com/help/matlab/ref/inputdlg.html |inputdlg|>: C = inputdlg({'please enter a:'}); a = str2doubl...

10 years ago | 0

| accepted

Answered
How to find strings of certain format within text file
Perhaps: str = fileread(...); C = regexp(str,'(A|B|C|AB|CD)\d+','match') Or perhaps: C = regexp(str,'[A-Z]+\d+','ma...

10 years ago | 0

Answered
How to Edit File Information in MATLAB File Exchange?
_"Is there a way to edit the file information (description) without updating your file (update suggests newer version)?"_ You...

10 years ago | 1

| accepted

Answered
Writing cell and numeric arrays into a same file?
% Fake data: X = repmat({'21-12-2016'},100,1); Y = repmat({'Wednesday' },100,1); Z = randi(99,100,10); % Write dat...

10 years ago | 0

Answered
How to get indices of unique elements in matrix in separate arrays
>> [R,C] = arrayfun(@(n)find(M==n),A,'Uni',0); >> Z = cellfun(@(r,c)[r(:),c(:)],R,C,'Uni',0); >> Z{:} ans = 2...

10 years ago | 1

Answered
Finding the index of dupplicate rows in a matrix
>> A = randi(1e4,275935,2); >> [B,~,Y] = unique(A,'rows','stable'); >> [C,X] = hist(Y,unique(Y)); >> Z = ismember(Y,X...

10 years ago | 1

Answered
What is type of "Spline" function and how can I solve it mathematically to get coefficients?
Why not read just the <https://www.mathworks.com/help/matlab/ref/spline.html |spline|> documentation? The |spline| documentat...

10 years ago | 0

Answered
Reformatting a cell array based on the duplicates
Not quite one line: >> [U,~,idx] = unique(A(:,1)); >> C = arrayfun(@(n)A(idx==n,2),unique(idx),'Uni',0)'; >> N = max(...

10 years ago | 1

Answered
Convert 2d matrix to 3d matrix with help of indices
You can use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|> like this: W = 40; % window S = 20; % shi...

10 years ago | 1

| accepted

Answered
How to read in specific File names?
>> C = {'A_NDE.csv';'B_DE.csv';'C_DE.csv';'E_NDE.csv';'F_NDE.csv'}; >> T = regexpi(C,'_(N?)DE.csv$','once','tokens'); >>...

10 years ago | 1

| accepted

Answered
Using repelem without prior knowledge of the number of matrix dimensions
It is easy to generate a <https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html comma separated list> fro...

10 years ago | 1

| accepted

Answered
How to get row vector for a folder of text files?
P = 'absolute/relative path to where the files are saved'; S = dir(fullfile(P,'*.txt')); for k = 1:numel(S) F = fullfile(...

10 years ago | 1

| accepted

Answered
How to calculate ratio of elements of a column?
>> B = A(2:end)./A(1:end-1) B = 2 1.5 1.3333 1.25 1.2 ...

10 years ago | 1

| accepted

Answered
How to Add an Alphanumeric Character to a Shape?
Use <https://www.mathworks.com/help/matlab/ref/text.html |text|>: >> pos = [2,3,5,5]; >> r = rectangle('Position',pos, '...

10 years ago | 0

| accepted

Answered
Comparing each vector in a cell array to another vector
*Method one: one |ismember| call:* the function |ismember| is going to to be slowest operation, so one simple speedup is to redu...

10 years ago | 1

| accepted

Answered
How do I use a struct as a function input?
Assuming that |rules| is a cell array of strings, then you just need this: >> rules = {'bef1','aft1','bef2','aft2','bef3','a...

10 years ago | 2

Answered
clc % clear the command prompt close all fprintf('wait please\n'); % to print a string in command prompt imaqreset % disconnect and delete all image aquisition objects clear all
Possibly you are running Octave code: <https://octave.sourceforge.io/tisean/function/delay.html |delay|> is an Octave function, ...

10 years ago | 0

Answered
matric "c" and "d" out of for loop and c row matrix corresponding to minimum distance
Here is a simpler version of your code: m = 2; T = [1,0,0;0,(1/sqrt(2)),(1/sqrt(2))]; V1 = 0.956; V2 = 2.4; c...

10 years ago | 0

| accepted

Answered
How can i do let Matlab returns variable name when i check its value?
This works for any number of variables, just add them to the cell array |V|: V = {'x','y','z'}; S = struct(); for k =...

10 years ago | 1

| accepted

Answered
Remove zero padding in the vector which has element 0
You can use <https://www.mathworks.com/help/matlab/ref/find.html |find|> for this: >> newA = [1,36,28,95,64,125,44,96,93,21...

10 years ago | 2

| accepted

Answered
How to create array of alphanumeric
You could create a <https://www.mathworks.com/help/matlab/cell-arrays.html cell array> of strings: C = {'A1','A31','A61','A9...

10 years ago | 2

| accepted

Answered
create a structure from a matrix
Lets have a look: fields='number'; defines a 1xN character array. This is okay. But for i={1:max(numb)}; likely do...

10 years ago | 0

| accepted

Answered
Subscript indices must either be real positive integers or logicals error, how can I fix?
The error message tells us that you are trying to index using an inappropriate value. Have a look at this line: m(n) = ... ...

10 years ago | 1

| accepted

Answered
Reshape a matrix dimension
reshape(A,12,110,14,4) and you might need |permute| too. MATLAB has excellent documentation online, which is free for any...

10 years ago | 0

Answered
copy matrix to struct array
[M.x] = deal(A)

10 years ago | 1

Answered
How can I check if I have a databse toolbox
Run this in the command line: ver

10 years ago | 1

| accepted

Answered
How to format a cell array
The simplest would be as a simple numeric array, so use: cell2mat(X) Or, if you really want a cell array, then try: n...

10 years ago | 0

Answered
How Can i speed up "for" loop ?
MATLAB's most basic data type is the array, and one can perform many operations on the whole array at once: https://www.mathwor...

10 years ago | 10

| accepted

Answered
How to create a symmetrical matrix?
I looked at this task, and tried several possibilities to convert this: >> M = [1,2,3,4,5;0,6,7,8,0;0,0,9,0,0;0,0,0,0,0;0,0...

10 years ago | 1

| accepted

Answered
Extract every second value of a vector and write into a new vector
This is MATLAB so why use an ugly loop? MATLAB is much better than that! The code is simpler without it (I also got rid of |sym|...

10 years ago | 0

Load more