Submitted


Round Dates and Times
Round dates/times to the nearest unit (round/floor/ceiling).

19 Tage ago | 3 downloads |

Thumbnail

Answered
Change from set notation to dot notation
The MATLAB documentation explains that dot-notation only applies to scalar objects: https://www.mathworks.com/help/matlab/creat...

19 Tage ago | 0

| accepted

Answered
How to read a file containing non numerical characters and commas?
opt = {'HeaderLines',22,'MultipleDelimsAsOne',true}; str = fileread('He_2.txt'); str = strrep(str,',','.'); C = textscan(str,...

19 Tage ago | 0

Answered
Error when taking an exponent from a large data set
x2 = exp(double(x1));

19 Tage ago | 0

Answered
how to avoid using a name to a specific file in GUI
Your explanation is not clear if you know Specificname in advance or not, or how many variables there are saved in the .mat file...

19 Tage ago | 0

| accepted

Answered
Experts of MATLAB, how did you learn? Any advice for beginner/intermediate users?
I reject the label "expert", but here is my two cents worth anyway: MATLAB Specific: MATLAB has a great feature that very few ...

20 Tage ago | 59

| accepted

Answered
Import .txt and save as .mat with conditions
As you did not supply an example file I created my own (attached). [fid,msg] = fopen('test.txt','rt'); assert(fid>=3,msg) C =...

20 Tage ago | 0

| accepted

Answered
How can I create a fullpath from images of different subfolders?
Do not use path as a variable name (you shadow the inbuilt function of that name). Do not concatenate strings to build paths. ...

21 Tage ago | 0

Answered
convert milliseconds (ms) to seconds (s)
You can change the format of how numbers are displayed, e.g. "shortG" >> format shortG >> ms/1000 ans = 1600.9 ...

23 Tage ago | 1

| accepted

Answered
From a given vector create all combinations possible
>> V = [5,10,15]; >> [X,Y] = ndgrid(V); >> M = [Y(:),X(:)] M = 5 5 5 10 5 15 10 5 10 10 ...

23 Tage ago | 0

| accepted

Answered
Finding values of specific range from table row or column
>> A = [12345 NaN NaN NaN NaN 457 NaN NaN NaN 785 NaN NaN NaN NaN NaN NaN 74502].' A = 12345 NaN NaN NaN NaN ...

23 Tage ago | 2

| accepted

Answered
Regular Expression to timestamp
>> rgx = '(?<H>\d*)(?(1):)(?<M>\d+):(?<S>\d+)\.(?<F>\d+)'; >> regexp('11:32.456',rgx,'names') ans = H: '' M: '11' ...

24 Tage ago | 0

Answered
Rescaling a variable with NaNs
>> M = randi(7,3,5); >> M(randi(numel(M),1,3)) = NaN M = 6 7 7 6 4 3 NaN 5 NaN 6 ...

24 Tage ago | 1

| accepted

Answered
how to remove the last column in the matrix?
>> A = [2,4,2,4,2,6,8] A = 2 4 2 4 2 6 8 >> B = A(1:end-1) B = 2 4 2 4 2 6

24 Tage ago | 0

| accepted

Answered
Fill an array after a for loop
These two changes make the code run without error: G = zeros(nraw,numel(x)); and G(i,:) = x; Whether it is correct only you ...

24 Tage ago | 0

| accepted

Answered
Convert a vector in Character array after a for loop
Avoiding character manipulations using basic indexing: >> x = [1,2,3,1]; >> V = 'A':'Z'; >> V(x) ans = ABCA

25 Tage ago | 0

| accepted

Answered
How to define and store string to matrix or array
With a simple cell array: N = 3; C = cell(1,N); for k = 1:N x = ... your code C{k} = x; end https://www.mathworks...

25 Tage ago | 0

| accepted

Answered
draw a graph from cell arrays
plot((Y{i},position);); % ^ ^^ not valid syntax should be plot(Y{i},position); PS: in future please show th...

25 Tage ago | 0

Answered
Round in a cell array that also contains string
idx = cellfun(@isnumeric,C); C(idx) = cellfun(@(x)round(x,N),C(idx),'uni',0)

25 Tage ago | 0

| accepted

Answered
How can I generate random single precision (float32) numbers ?
This generates all possible singles: >> V = ['0':'9','A':'F']; >> X = randi(16,1,8); >> V(X) ans = 7B3A5B5F >> N = typecast...

25 Tage ago | 1

Answered
Using a Variable inside the name to save a file
fnm = sprintf('date_%s_task.jpg',ID); saveas(gcf,fnm); Note that obtaining and referring to explicit graphics handles is more ...

25 Tage ago | 0

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...

25 Tage 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...

25 Tage 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...

25 Tage ago | 0

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

25 Tage 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;...

26 Tage 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 ...

26 Tage 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*...

26 Tage 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 ...

26 Tage 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...

26 Tage ago | 0

Load more