Answered
How to replace parts of the text using regexprep
This uses a slightly different approach using |regexp| and |strncmp|, which is based on the assumption that each command is on i...

8 years ago | 0

| accepted

Answered
How to read name of a recently imported struct
_"What I currently do is loading the file by giving the name, than reading the struct name by myself and writing it manually int...

8 years ago | 0

Answered
looping a for loop through an array
Where |V| is your 105120X1 vector of data: mean(reshape(V,12,[]),1); And checking using random data: >> V = randi(9...

8 years ago | 0

Answered
How to use if statement to compare strings
gI = ''; while ~ismember(gI,{'m','f'}) gI = input('Enter gender: ','s'); end

8 years ago | 0

Answered
Why is my for loop not iterating in the way I want?
N = 2; % the value to use. % Approximation: X1 = 1:12; % the number of terms. Y1 = nan(size(X1)); for k = X1 ...

8 years ago | 0

| accepted

Answered
i have a cell array storing few hundred vectors, how can i write them each line with only one vector to a file.txt without floats?
A simpler solution is to convert your data into one numeric matrix and use |csvwrite|: C = {[1,2,3,4],[2,3,4,5],[3,4,5,6]};...

8 years ago | 0

Answered
How to fix my recursive function?
function out = moreFactors(a,b,fact) ixa = fix(a)==a; % test if integer. ixb = fix(b)==b; % test if integer. if ixa ...

8 years ago | 0

| accepted

Answered
How to modify table elements without using a for loop?
Your original idea of using |strcmp| was perfect, there is no need to complicate things with strings: value = [1;2;3;4] ...

8 years ago | 1

| accepted

Answered
Variable input using a flag
MATLAB returns arguments based on demand, so you can simply define all three of them: function [out1, out2, out3] = myFun(i...

8 years ago | 0

| accepted

Answered
Make the subfolders name in output folder the same input folder
Do NOT use |cd|: this is a slow and inappropriate for reading/writing data. You should just use absolute/relative filenames gene...

8 years ago | 0

| accepted

Answered
Can someone help me write this into a series?
r = pi; n = 4; S = sum((2:2:2*n).*r.^(3:2:2*n+1)) Or r = pi; n = 4; v = 2:2:2*n; sum(v.*r.^(v+1))

8 years ago | 0

Answered
Colormap engineering to highlight small values
You will need to either: # scale the values before plotting (e.g. log/exp), or # create/find a suitable colormap that highli...

8 years ago | 1

Answered
How to process multiple .csv files?
You have a variable named |length|. This means when you write this: for k = 1 : length(theFiles) you are telling MATLAB ...

8 years ago | 0

| accepted

Answered
Shifting column of a matrix with maximum sum to the right?
>> M = randi(9,4,7) % fake data M = 9 5 5 1 6 9 4 3 5 8 9 1 5 2 2 ...

8 years ago | 0

| accepted

Answered
How to specify path in MATLAB?
<https://www.mathworks.com/help/matlab/ref/fgetl.html |fgetl|> only has one output argument, so calling it with two will throw a...

8 years ago | 0

| accepted

Answered
msg=dec2bin(32,8); encode_data=encode(msg,14,8,'cyclic');but it appears an error like "Output argument "code" (and maybe others) not assigned during call to "encode". Error in cyclic_code_check (line 12) encode_data = encode(msg,n,k,'cyclic')"
There are some differences between your two function calls: # character vs. numeric |msg|. # vector vs. matrix |msg|. App...

8 years ago | 0

| accepted

Answered
Read data from complex *csv file
This code imports that very messed up "CSV" file (attached): opt = {'Delimiter',',', 'CollectOutput',true}; S = fileread...

8 years ago | 0

| accepted

Answered
Undefined variable error while the variable was indeed defined right before the use
@Kunhuan Liu: the reason is very simple: every function has its own workspace with its own variables: <https://www.mathworks....

8 years ago | 0

| accepted

Answered
Creating a conditional vector
Do NOT use a loop for this! >> a = [0,0,1,0;0,1,1,1;0,1,0,1;1,1,0,1] a = 0 0 1 0 0 1 1 1 0...

8 years ago | 0

| accepted

Answered
How do I output the same single parameter for a set of different files?
If you want to save the values from both loops, then you will need to use indexing corresponding to both loops. Currently you us...

8 years ago | 0

| accepted

Answered
How to change the size of the MATLAB GUI
<https://www.mathworks.com/matlabcentral/answers/153254-matlab-scaling-issue-on-high-resolution-high-dpi-displays>

8 years ago | 0

Answered
reshaping vector with uneven elements and zero padding
It would be simpler to use a cell array and |mat2cell|: >> A = [5,3,8,2,3,5,8]; >> B = [2,3,2]; >> C = mat2cell(A,1,B...

8 years ago | 1

Answered
Nested While and For Loop
You define |Eqn2| to be zero: Eqn2 = 0; and then inside the loop you try to access it using indexing: Eqn2(X1+Value...

8 years ago | 1

Answered
How to print result in matlab?
>> D1 = datenum('31.10.18','dd.mm.yy'); >> D2 = datenum('3.11.18','dd.mm.yy'); >> V = D1:D2; >> datestr(V(:),'dd.mm.y...

8 years ago | 1

| accepted

Answered
Pairwise matrix creation in matlab
>> R = [1,2,3]; >> C = [1;2;3]; >> C./R ans = 1.00000 0.50000 0.33333 2.00000 1.00000 0.66667 ...

8 years ago | 0

Answered
how can i move a certain windw of a 3D array to another 3D array?
I suspect that the indexing is a red herring, and you just want this: window_cube = matrix3D(row1:row2, col1:col2, 1:Frames...

8 years ago | 0

Answered
New variable for each xlsread from a different file
As shown in the MATLAB documentation <https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html> ...

8 years ago | 1

| accepted

Answered
Error loading file that exists, after ls, will load one time and then won't load.
Possibly this is due to delays in synchronizing with Google drive: <https://www.mathworks.com/matlabcentral/answers/37906-goo...

8 years ago | 1

| accepted

Answered
How to separate a column into rows based on the element of a different column?
This is a lot easier if you simply store the scalar numeric values in one numeric array (use |cell2mat| if required): >> A ...

8 years ago | 1

| accepted

Load more