Answered
Find out the rows having same values in all columns of a matrix
Something like this should get you started: >> A = [0,0,0,0,1,0,0;1,0,0,0,0,1,0;1,0,0,0,0,1,0;0,1,0,1,0,1,0;1,0,0,0,0,1,0;0,0,0...

7 years ago | 1

| accepted

Answered
How to convert char into string?
>> str = 'd879c14e5b1fa7a413aa46bbbc2b8710'; >> dec2bin(sscanf(str,'%2x')) ans = 11011000 01111001 11000001 01001110 0101...

7 years ago | 0

| accepted

Answered
How to get rid of this error?
"No i want to convert binary vectors higher than 53 bits" MATLAB's native floating point numeric class double does not support ...

7 years ago | 0

Answered
Resize a matrix into another with different size
A simpler solution: >> X = 1:26; >> R = 4; >> N = numel(X); >> M = nan(R,ceil(N/R)); >> M(1:N) = X M = 1 5 9...

7 years ago | 1

Answered
How to define cells' position in array?
M(1,1) % TL M(1,end) % TR M(end,1) % BL M(end,end) % BR

7 years ago | 0

Answered
Why there is no line in my graph?
"Why there is no line in my graph?" Because you are plotting one scalar point on each loop iteration. This will NOT give a line...

7 years ago | 1

| accepted

Answered
Indices and Filling Vectors
Use repelem or kron: >> t = [1,2,1,2,1,3]; >> d = kron(t-1,ones(1,5)) d = 0 0 0 0 0 1 1 1 1 1 0 0 ...

7 years ago | 1

| accepted

Answered
Linear Interpolation without interp1
"I thought there would be some way to identify the previous/next element from the entered x value in the array but I can't manag...

7 years ago | 0

Answered
how do I find the locations of values in a matrix?
Use ismembertol, something like this (untested, but should get you started): DN = datenum(2018,1,1,00,00,00):0.020833:datenum(2...

7 years ago | 0

| accepted

Answered
To refer index of the first number in every column in 3d matrices
Your question is not clear because you ask for "the first number in every column", i.e.: t(1,:,1) t(1,:,2) t(1,:,:) %both Bu...

7 years ago | 1

| accepted

Answered
Assigning numbers to 3d matrix.
t = reshape(1:30,5,3,2) or t = nan(5,3,2); t(:) = 1:30 or t = [1;2;3;4;5]+[0,5,10]+reshape([0,15],1,1,[])

7 years ago | 1

| accepted

Answered
scalar to vector formation, k = [k1 k2 k3 k4] to [k1,-k1,0,0:-k1,k1+k2,-k2,0:0,-k2,k2+k3,0:0,0,-k3,k3+k4]
k = [0.6337,0.6337,0.6337,0.6337]; n = numel(k); m = zeros(n); m(2:n+1:end-n) = 0-k(1:end-1); % lower m(1+n:n+1:end) = 0-k(...

7 years ago | 0

| accepted

Answered
Insert number 1 to certain column and row in a matrices
>> t = zeros(9,10,2); >> t([43,53,62,72,81,97]) = 1 t(:,:,1) = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

7 years ago | 0

Answered
Sorting with high precision
"Is there a way to choose how accurate the sort function is?" No. And rounding is not a good solution, because it introduces ar...

7 years ago | 0

| accepted

Answered
Is there a way to replace a paragraph of lines with another set of lines using regexprep ?
"The problem is I guess the regexprep is not able to read and replace \n ,the newline character." There is absolutely no reason...

7 years ago | 0

| accepted

Answered
randomly change signs of certain elements in a matrix
Do NOT use a loop for this! You can do this very simply with logical indexing: >> a = [1,-1,1;1,1,1;-1,-1,1] a = 1 -1 1...

7 years ago | 0

| accepted

Answered
Move file based on filename
https://www.mathworks.com/help/matlab/ref/movefile.html old = 'path to original folder'; new = 'path to destination folder'; ...

7 years ago | 1

| accepted

Answered
How can I use for loop to reduce the number of lines from the following code
This is MATLAB, so here is a much simpler solution without any loops: M = C1(1:399,5:11); R = mean(permute(M,[3,2,1]).*permu...

7 years ago | 0

| accepted

Answered
sscanf reader format problems
>> str = '18-11-20 22:25:00.000 BRUX XXX 2 0 0 0 4027896.395'; >> sscanf(str,'%f-%f-%f%f:%f:%f %*s %*s%f%f%f%f%f') ans = ...

7 years ago | 0

| accepted

Answered
How can I delete the rows of a matrix in matlab under a given condition
@Sky Scrapper: the standard MATLAB practice is to use any: >> A = [110,0,10,70,15;100,30,50,20,9;50,-150,95,65,7] A = 110 ...

7 years ago | 0

Answered
Command and Control vectors
>> t = [1,2,1,2,1,3]; >> kron(t-1,ones(1,5)) ans = 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 ...

7 years ago | 0

Answered
loading and storing specific field of many different file names of a struct
Method one: dir and a structure array: D = uigetdir(); S = dir(fullfile(D,'*.mat')); for k = 1:numel(S) S(k).import = lo...

7 years ago | 1

Answered
How to efficiently encode two values as a unique entitiy
M = [1,2,3;NaN,4,5;6,7,8]; C = M(A,B) "In addition, I also wonder if we can scale it up for A=[2;2;3;1] and B= [1;1;3;1]" ar...

7 years ago | 0

| accepted

Answered
How to loop through a matrix, one row at a time using a for loop and conditions
Simpler: M = [20,5;30,-6;40,8;50,10] X = all(M>=0,2) for k = 1:size(M,1) if X(k) M(k,:) end end

7 years ago | 0

Answered
From vector to matrix reshape every ith rows for each column
>> mat = [arr,arr,arr] mat = 1 1 1 2 2 2 3 3 3 1 1 1 2 2 2 3 3 3 1 1 1 ...

7 years ago | 0

Answered
How do I use information in mat file?
D = 'path to folder where those files are saved'; S = dir(fullfile(D,'*.mat')); N = natsortfiles({S.name}); % download from FE...

7 years ago | 0

| accepted

Answered
How to change HH:MM:SS string data to HH.MM.SS ?
>> [~,~,~,~,MN,S] = datevec([now;now-pi]) MN = 10 46 S = 22.414 28.810 >> MN+S/60 % makes mathematical sense ...

7 years ago | 0

| accepted

Answered
Change variable names in a table
You can use a cell array of names, like this: rfi.Properties.VariableNames = {'name1','name2',...} See: https://www.mathworks....

7 years ago | 3

| accepted

Answered
De-serialze char array to object
"is there a better (more elegant) way to do this?" save and load, or: https://undocumentedmatlab.com/blog/serializing-deserial...

7 years ago | 0

Answered
Please help, indexing of ND-Dimensional matrices
reshape(A,10,2,3) But it really depends on the order that you want B to have, which you did not tell us. You might need to use ...

7 years ago | 0

| accepted

Load more