Answered
store workspace file in variables using a for loop
Your approach is entirely the wrong way around. Putting meta-data (e.g. pseudo-indices, subject IDs, parameter values, etc.) int...

6 years ago | 0

| accepted

Answered
How to get common sub string in cell array string?
1- Download and unzip John D'Errico's FEX submission https://www.mathworks.com/matlabcentral/fileexchange/27460-string-subseque...

6 years ago | 1

| accepted

Answered
# 1:end
"explain please" Explanation "why this fill whole matrix" g(r(1:end),c(1:end))=1 The MATLAB documentation explains "There is...

6 years ago | 0

Answered
I have a 2 by 26 matrix, how do i randomly select one of the rows and extract them?
idr = randi(26,1,1); row = shiptext(idr,:)

6 years ago | 0

| accepted

Answered
Periodically save matrixes (or workspace) within PARFOR loop
https://www.mathworks.com/matlabcentral/answers/135285-how-do-i-use-save-with-a-parfor-loop-using-parallel-computing-toolbox No...

6 years ago | 1

Answered
Why doesn't cd command work on parametric directory names ?
"How can I resolve it ?" Use function syntax (not command syntax): cd(sub) https://www.mathworks.com/help/matlab/matlab_prog/...

6 years ago | 1

| accepted

Answered
Stop the Inf numbers
You used the wrong operator: mrdivide / solves a system of linear equations. You need to learn the differrences between matrix ...

6 years ago | 1

Answered
Problem with regexp Japanese
The \u syntax is not valid in MATLAB: \u3000 % !!! NOT CORRECT !!! To create a character from hexadecimal use \x: \x3000 Sou...

6 years ago | 1

| accepted

Answered
How to find the position of the first non-zero element of my matrix?
find(yourVector,1,'first')

6 years ago | 5

| accepted

Answered
Sorting alphanumeric data and then grouping by number - is this possible?
>> C = {'MyCulture/Cell316';'MyCulture/Cell0';'MyCulture/Cell339';'MyCulture/Cell0';'MyCulture/Nucleus50';'MyCulture/Nucleus0';'...

6 years ago | 0

| accepted

Answered
Difficulties with interpreting and use of @ sign
There is nothing stopping you from having an unused input argument: f = @(t,y)((y-1)*(y-2)) % ^ perfectly okay to define t...

6 years ago | 2

| accepted

Answered
How to process files of a particular order in MATLAB?
"Possibly what is the error, it says that File doesn't exist." Most likely the files do not exist in the location where you are...

6 years ago | 0

| accepted

Answered
How to restrict input string in length,symbols, char and numbers
>> str = 'XYZ-99-123'; % okay >> ~isempty(regexp(str,'^[A-Z]{3}-\d{2}-\d{3}$','once')) ans = 1 >> str = 'XYZ-99-ABC'; % not o...

6 years ago | 0

| accepted

Answered
Convert a cell array into matrix, but with removing the words / commas
In both cases it looks like you are processing data imported from a file, in which case it would be much more efficient to fix t...

6 years ago | 0

| accepted

Answered
How to put for loop outputs into array?
With MATLAB it is always much simpler and more versatile to loop over indices, rather than looping over data. When you do that, ...

6 years ago | 0

Answered
for end loop variable not saving
Your code calculates numFrames using two different methods. method gives 500 (apparently correct), method gives 1 (apparently ...

6 years ago | 0

Answered
How do I loop trough variables
"Why is that?" Your confusion stems from several things. [] square brackets are a concatenation operator, not a "list" operato...

6 years ago | 0

Answered
How to find the max matrix of a multidimensional matrix array
I suspect that you actually mean that you have a 3D array, in which case you can use max: max(multiarray_star,[],3)

6 years ago | 2

| accepted

Answered
All possible n-length combinations of two numbers
Use ndgrid: (in these examples I used u=5, v=7): [X,Y] = ndgrid([5,7]); % n = 2 M = [X(:),Y(:)] [X,Y,Z] = ndgrid([5,7]); % n ...

6 years ago | 1

| accepted

Answered
Making matrices of different dimensions and clubbing them together
A simple and efficient approach using a cell array: N = number of loop iterations C = cell(1,N); for k = 1:N ... your co...

6 years ago | 0

| accepted

Answered
10 by 10 matrix grid
Use a table: https://www.mathworks.com/help/matlab/tables.html

6 years ago | 1

Answered
Taking 3-D matrices out of a 4-D matrix
Although most likely you would be better off not splitting up your perfectly good numeric array, if you really want to you could...

6 years ago | 0

| accepted

Answered
How to change a function within a loop at certain point in MATLAB
" I tried some stuff with while loops and if statements..." That is entirely the wrong approach in MATLAB. Just use logical ind...

6 years ago | 0

Answered
Coordinates of a 3 by 3 by 3 array
Solution For >2 dimensions you need to use ind2sub (as the find documentation also mentions): >> yy = zeros(3,3,3); >> yy(1,2...

6 years ago | 1

Answered
Saving nonempty columns of cell as separate variables with specific names in matfile
Fake data: >> allad = cell(1,80); >> allad{8} = rand(10000,1); >> allad{25} = rand(5000,1); You can use cell2struct and save...

6 years ago | 1

| accepted

Answered
"V = V.';" What Does This Syntax Mean?
The difference is: ' complex conjugate transpose. .' transpose Several basic numeric operations have two versions, one for l...

6 years ago | 0

| accepted

Answered
how to check if random number is equal to 1
x = [1,3,3]; v = randi(numel(x)); total = total + x(v); if x(v) == 1 r = 1; end

6 years ago | 0

Answered
How to access all elements within a structured cell array without looping?
"I am not using the structure(1).field1 syntax" You should be. It would allow you to use efficient syntaxes for accessing your ...

6 years ago | 1

Answered
How to tell if a value is an integer?
"...which should apply to this since x=1925 ..." Nope. Its actual value is: >> x = 725*(77/29); >> fprintf('%.40f\n',x) 1925...

6 years ago | 1

| accepted

Answered
I want to split cell vector
Using datetime: >> DT = datetime(date,'InputFormat','yyyy-MM-dd'); >> DT.Year ans = 1985 1985 1985...

6 years ago | 0

| accepted

Load more