Answered
How to generate variable names from a cell array
https://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html https://www.mathworks.com/matlabcentral/answers/304528...

7 years ago | 0

| accepted

Answered
How to copy every 500 rows to a new variable?
https://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html https://www.mathworks.com/matlabcentral/answers/304528...

7 years ago | 2

| accepted

Answered
How to create new variables in batches with strcat
https://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html https://www.mathworks.com/matlabcentral/answers/304528...

7 years ago | 9

| accepted

Answered
How to prevent a figure window to automatically take focus
The solution requires a few trivial changes to your code: Create any figures before the loop, adding any placeholder axes/lines...

7 years ago | 1

Answered
Find all combinaisons of sum of two vector that corresponds to the value of a third vector
Simpler to use ndgrid: >> A = [1561.28, 1561.64, 1562.00, 1562.36, 1562.72]; % signal >> B = [1064.00, 1064.36, 1064.72, 1065....

7 years ago | 0

Answered
Replacing commas with whitespaces using regexprep
>> str = '(asdf,(50,51,52),jkl)'; >> regexprep(str,'(\d+),(\d+),(\d+)','$1 $2 $3') ans = (asdf,(50 51 52),jkl) If you are alr...

7 years ago | 0

| accepted

Answered
Documentation of differences between Matlab versions
https://www.mathworks.com/help/matlab/release-notes.html

7 years ago | 1

| accepted

Answered
could anyone help me to solve the issue with respect to the code
"What i actually need is idx should be different for each run" The easiest way is to define them before the loop, e.g.: A = 1:...

7 years ago | 0

Answered
Extracting specific rows from multiple data files to store as variables
"....and store in such a way that allows me to keep track of which stems from which file." That is easy using the structure ret...

7 years ago | 1

| accepted

Answered
Unable to perform assignment because dot indexing is not supported for variables of this type.
You re-defined the variable name for the loop iterator variable: dots.nDots = 100; %^^^ variable name. for dots = 1:dots.nDot...

7 years ago | 0

| accepted

Answered
how to extract data from the fixed-width-field format using fscanf or textscan
A simple solution based on regeprep and sscanf. Before the file-reading loop: vec = [8,16,16,16,8,8]; rgx = sprintf('(.{%d})',...

7 years ago | 2

Answered
Generating vectors of length N with only -1s and 1s.
>> M = 5; >> N = 19; >> randi(0:1,M,N)*2-1 ans = -1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 ...

7 years ago | 0

| accepted

Answered
Given a matrix A, create the matrix B whose elements are the neighbor sumr for A
Much simpler to just use conv2: >> A = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16] A = 1 2 3 4 5 6 7 ...

7 years ago | 1

Answered
finding number sequences in a vector and set them to the adjacent values
>> V = [ 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0] V = 0 0 0 0 0 0 0 0...

7 years ago | 1

| accepted

Answered
getting Complex double in matlab while excel solves it
(1-exp(-(WL-0.26053)./0.15994)).^2.28411 % % ^^^^ ^ positive values (around 5) %^^^ ...

7 years ago | 0

| accepted

Answered
1) I need a code to determine the intersection points, I have tried '==' is not working, also I would like to know if it is possible to make the grid line look like a graph sheet i.e using Xtick and Ytick
Use fzero to find the intersection of two functions. Method one: functions >> F1 = @(x)1.5*x-1; >> F2 = @(x)0.3*x; >> X = 0:...

7 years ago | 3

Answered
How to access induvidual elements in a string
The simplest and most efficient solution is to use sscanf: >> S = '23hrs 45min'; >> V = sscanf(S,'%fhrs%fmin') V = 23 ...

7 years ago | 0

Answered
Using a binary matrix as an index to select values from another matrix
>> X = [1,0;3.5,1;0,6]; >> p = [13,12;11,19;22,23]; >> p.*(X==1) ans = 13 0 0 19 0 0

7 years ago | 0

Answered
Executing .m files function in R2015b is not working properly
Ugh, invalid filenames and anti-pattern dynamic variable names... it seems that your task was explicitly designed to torture int...

7 years ago | 0

| accepted

Answered
Check if any elements of cell array are equal ?
Matching: >> a{1}=[1,1,0]; >> a{2}=[9,9,9,9]; >> a{3}=[1,1,0]; >> a{4}=[]; >> N = numel(a); >> [X,Y] = ndgrid(1:N); >> Z ...

7 years ago | 3

| accepted

Answered
Code for Multiple Matrix Multiplication
>> T=randi(9,4,4,3); % fake data >> T(:,:,1)*T(:,:,2)*T(:,:,3) % your approach ans = 2359 1398 2072 2154 1788 ...

7 years ago | 0

| accepted

Answered
how xor is used between two no.? or which command ?
I suspect that you actually want to be using bitxor (and possibly also specify the classes): >> bitxor(mod(176+233,256),142) a...

7 years ago | 1

| accepted

Answered
How to create legend from cell array?
Simply using one cell array: legend(itm{2}(1:4)) or using your approach of separate input arguments (character vectors): lege...

7 years ago | 1

| accepted

Answered
Extracting data from multiple structures in a .mat file
Do NOT load directly in the workspace. If you do that, then you will force yourself into writing slow, complex, buggy code by t...

7 years ago | 1

| accepted

Answered
how can I generate random decimal numbers in a specific decimal range?
v = [-2.96706,2.96706]; v(1)+diff(v)*rand(1,6)

7 years ago | 0

| accepted

Answered
How to delete numbers from cell?
Simpler with regexprep: >> D = regexprep(C,'^\S+\s*','') D = 'SPEED MEASURED 1 [rpm]' 'MOTOR SPEED [rpm]' 'MOTO...

7 years ago | 2

| accepted

Answered
To assign to or create a variable in a table, the number of rows must match the height of the table
You wrote a literal string instead of concatenating the variable data onto the end of the character vector. fullfile('C:\Users\...

7 years ago | 0

| accepted

Answered
Matlab is giving conflicting results, please help.
"...but Matlab still says they aren't equal?" Because they aren't equal. This is very easy to check (you already used one meth...

7 years ago | 0

| accepted

Answered
How to read specific lines from a text file and store them in a matrix?
This code should work regardless of the number of rows or columns: opt = {'Headerlines',3, 'CollectOutput',true}; fid = fopen(...

7 years ago | 1

| accepted

Load more