Answered
the logical answer is 1
The MATLAB Editor will highlight assignments without a semi-colon: https://www.mathworks.com/help/matlab/matlab_prog/check-code...

7 years ago | 0

Answered
How to resize a matrix with zeros in between elements
Some general solutions for matrix A of any size. >> A = [10,5;4,10;2,3]; Method one: sub2ind: >> [R,C] = size(A); >> B = zer...

7 years ago | 2

| accepted

Answered
Transform a 3D dimension array to n 2D matrix
"How can I transform a 3D dimension array (15*781*81) to 15 extracted 781*81 2D matrix to make it feasible to write down them in...

7 years ago | 0

Answered
how to stop changing of a variable?
Use a nested function: logic = true; ... function ... ... logic = logic && s<200; ... end ... Or a ...

7 years ago | 0

| accepted

Answered
All possible permutation of a given vector.
V = [1,2,3,4,1]; N = numel(V); % Permutations: P = perms(V(2:N)); P(:,N) = V(1); P = unique(P,'rows') % Rotations: R = P;...

7 years ago | 0

| accepted

Answered
Finding the average of every nth row but n is not fixed.
>> M = [1,10;1,11;1,20;2,4;2,9;2,8;2,8]; Method one: accumarray: >> V = accumarray(M(:,1),M(:,2),[],@mean) V = 13.667 ...

7 years ago | 0

| accepted

Answered
wildcard in dir command - single char
dir does not support single-character wildcards. You could remove the superfluous filenames afterwards, e.g.: >> S = dir('aaa*...

7 years ago | 0

Answered
How to assign few of the array values with a constant randomly .
"How to assign few of the array values with a constant randomly ." >> n = 10; >> m = 4; >> V = zeros(1,n); % generate array ...

7 years ago | 1

| accepted

Answered
Why "undefined variable" error keeps coming when infact the variable is defined?
stats is empty so your loop never runs (i.e. the code inside the loop never runs so those variables are not defined). This occur...

7 years ago | 0

Answered
Transforming HH:mm:SS to 'dd.MM.yy HH:mm:SS' and loosing seconds
"I would like to add current date to the 'time'" Sure, that is easy, by just adding a duration object to a datetime object. Yo...

7 years ago | 0

| accepted

Answered
How to create a .mat file
"How to create a .mat file" Use save, which is the MATLAB command explicitly designed to write .mat files. "I need to create a...

7 years ago | 0

| accepted

Answered
Splitting based on delimiter but only once
>> S = 'Country ˈk ʌ n t r i'; >> C = regexp(S,' ','split','once') C = 'Country' 'ˈk ʌ n t r i'

7 years ago | 1

Answered
how to use a file from a different directory?
Use fullfile to build the full filename: function B(dirName) N = inifile(fullfile(dirName,'c.ini'),90) ... end

7 years ago | 0

| accepted

Answered
Putting the result from eval into a cell array
N = 600; C = cell(1,N); % preallocate. for k = 1:N G = [F(k)+1,F(k+1)]; % you never use G anywhere in your code... C...

7 years ago | 0

Answered
How can I import repeating blocks of mixed data as a table?
This imports and parses your example file: str = fileread('Data.txt'); str = regexprep(str,{'= ','[\r\n]+SNC','[\r\n]+'...

7 years ago | 2

| accepted

Answered
How to illustrate a cell array
There are no doubt many ways of doing this, one relatively intuitive way would be to use scatter. This should get you started (b...

7 years ago | 1

| accepted

Answered
How do I use sprintf with two variables with different sizes?
Assuming that you have nested structures, then you can easily do something like this: >> s(1).rawdata.data00 = 100; >> s(1).ra...

7 years ago | 0

| accepted

Answered
Color and brightness in imread
Your image is actually an indexed image, not a grayscale image, and this is easy to find out using the inbuilt imfinfo: >> imfi...

7 years ago | 0

| accepted

Answered
How to remove everything from string except what's inside square brackets?
Where C is your cell array: >> D = regexp(C,'\[(.+)\]','tokens','once') >> D = vertcat(D{:}) D = 'rpm' 'rpm' ...

7 years ago | 0

Answered
Exponent on top or on the right of the axis, control, turn off?
Either set the number format or the exponent: https://www.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-l...

7 years ago | 3

| accepted

Answered
ismember(A,B,'rows') indexing
>> one = {'ADSµSOIC8';'AVX0603';'ELN';'ELNH10';'EPC';'EPC0603';'FAGDO214AA';'FAGDO214AA (SMB)';'FAGDO214AB';'FAGDO214AC';'FAGSMA...

7 years ago | 1

| accepted

Answered
How can I make a single plot that consists of multiple lines, each made from every n rows of a vector?
"I'm sure I will need to use a loop because I won't be able to do this manually for a 300,000 x 2 set of data." I don't see why...

7 years ago | 0

| accepted

Answered
logaritmical spacing / incremented spacing
>> diff(fix(log2((1:32).'))) ans = 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 ...

7 years ago | 1

| accepted

Answered
Split string into string based on character type
>> S = '1A2'; >> C = regexp(S,'(\d+)(\D+)(\d+)','tokens','once') C = '1' 'A' '2'

7 years ago | 0

| accepted

Answered
Transferring data from a cell array to a vector
"can i convert this data into vector?" >> Atlas = {122,12} ; >> vec = [Atlas{:}] vec = 122 12 https://www.mathworks.c...

7 years ago | 1

Answered
How to append cell arrays with a very specific form
As long as your data meet some assumptions: each group contains exactly the same number of rows (four in your example), and ea...

7 years ago | 1

| accepted

Answered
Execute code faster for saving files with a matrix
"Any ideas how to run faster my code" Don't use xlswrite to write text files! Do not convert between data classes (e.g. do not...

7 years ago | 0

| accepted

Load more