Answered
Sorting columns of cell Array
Either download my FEX submission natsort: https://www.mathworks.com/matlabcentral/fileexchange/34464-customizable-natural-orde...

11 Tage ago | 1

| accepted

Answered
the problem of using 'case'
Your first (inadvisable, numerically fragile, should-be-avoided) concept works for me: for omega = 0.1:0.1:2; switch omega ...

11 Tage ago | 1

| accepted

Answered
Search a matrix combined with logical indexing
>> A = [3,10,2,5;2,14,5,3] A = 3 10 2 5 2 14 5 3 >> N = 10; >> B = A.*(cumsum(A>N,2)>0) B = 0...

12 Tage ago | 0

| accepted

Answered
Storing multiple value in array without overriding.
"How to avoid that?" Simply by changing the Excel worksheet name on each iteration of the outer loop, e.g.: ... for z=1:nfile...

13 Tage ago | 0

| accepted

Answered
How to create a for loop through a directory for only certain folders in the directory
An efficient MATLAB solution: P = 'absolute/relative path to the parent directory Sample'; S = dir(fullfile(P,'sub*')); F = {...

13 Tage ago | 0

Answered
How can I make an array of structs , each struct have a unique index?
"How can I make an array of structs , each struct have a unique index?" Easily: https://www.mathworks.com/help/matlab/matlab_pr...

13 Tage ago | 0

| accepted

Answered
Regular Expressions using regexp
Matching only integer numbers after 'UZK' or 'T_' (it is unclear in your question if the underscore is permitted or not, but the...

13 Tage ago | 1

| accepted

Answered
How to read elements from a computed matrix without define a new variable?
MATLAB does not allow indexing into the results of operations. You can either use a temporary variable (which is probably the mo...

14 Tage ago | 0

| accepted

Answered
Matrix Maipulation and adding from variables in the workspace
Load the file into a variable (which is a structure) and access its fieldnames: S = load(...)

14 Tage ago | 0

Answered
ERROR-The statement cannot be reached
Those warnings are very simple to understand by aligning the code and looking at the values. MATLAB warns you that lines 14 and...

14 Tage ago | 2

| accepted

Answered
Using semicolon for input argument when working with a matrix function
" I was thinking concatination, concatinating the same matrix 4 times but multiplying it by 1,2,3, then 4 as requested." It wou...

14 Tage ago | 1

Answered
Comma separated value to vector
>> S = '11,333,4445,2,78,2399'; >> V = sscanf(S,'%f,',[1,Inf]) V = 11 333 4445 2 ...

14 Tage ago | 0

| accepted

Answered
Replacing individual Values in Data column based on a condition
idx = myData.fluid_p_rel<0.9 | myData.fluid_p_rel>1.2; myData.fluid_p_rel(idx) = 1

15 Tage ago | 0

| accepted

Answered
How to convert column datetime to datenum?
It is not clear from your example what class data has: a table or a non-scalar structure or .. ? In any case, datetime objects ...

15 Tage ago | 1

| accepted

Answered
Error when calling a function : "Dimensions of arrays being concatenated are not consistent."
The full error message is this: Error using vertcat Dimensions of matrices being concatenated are not consistent. Error in fu...

15 Tage ago | 2

| accepted

Answered
Counting zeros in array
Simpler: >> V = [1,-2,-1,-1,-1,0,0,-1,0,0,0,3,0,0,4,0,0,0,0,0]; >> X = find([V(1:end-1),1]); >> Z = [diff([1,X+1])-1;V(X)].' ...

17 Tage ago | 3

Answered
Converting binary like table but using decimal values
You can use comma-separated lists on the output of ndgrid: https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-li...

17 Tage ago | 0

| accepted

Answered
How do i compare cell array values and replace with string of code letters?
Method one: >> C = {'UUU','CUU','UUC','UUG'}; >> F = {'UUU','UUC'}; >> L = {'UUA','UUG','CUU','CUC','CUA','CUG'}; >> Xf = is...

17 Tage ago | 0

| accepted

Answered
How to get nearest values in matrix and save indexes of these values?
>> X = [5,10,15]; >> Y = 0:7/5:30; >> [~,Z] = min(abs(X-Y(:))) % the indices of the closest values: Z = 5 8 12 ...

17 Tage ago | 2

| accepted

Answered
Operation on structure fields with common part of the field name
S.DUT_2 = 2; S.REF_2 = 3; S.DUT_4 = 4; S.REF_4 = 5; C = fieldnames(S); U = unique(regexp(C,'\d+$','once','match')) F = @(n...

17 Tage ago | 0

| accepted

Answered
how to change multiple items in a text file?
EDIT: much faster: rpl = '2.5'; % the new value (you can generate this using NUM2STR). str = fileread('bp.txt'); str = strtri...

17 Tage ago | 0

| accepted

Answered
Extracting numbers from a G-code file
Simple use of one regular expression is all that you need to identify those X, Y, and E values: str = fileread('test.txt'); rg...

17 Tage ago | 2

Answered
Adjusting the dimensions of input argument
A = A(:).';

18 Tage ago | 1

| accepted

Answered
How to convert string to number?
"...how do I convert it back to a number?" Convert to numeric: num = str2double(id1) "Now i want to check if the value is a n...

18 Tage ago | 0

Answered
How can I make a random RGB array of either White Cells or Green Cells (or any two colours)?
This generates MATLAB standard 0-1 values (multiply by 255 and use uint8 if required): >> R = 5; >> C = 7; >> X = rand(R,C)<0...

18 Tage ago | 0

| accepted

Submitted


Convert between RGB and Color Names
RGB to color name. Color name to RGB. Palettes: CSS, HTML, MATLAB, SVG, X11, xcolor, xkcd,...

18 Tage ago | 74 downloads |

Thumbnail

Answered
Access to array of structs (no for loops)
"Is there a way to access all end values of datarow with one command (no for loops or temporary variables)?" Nope. "Anyone som...

18 Tage ago | 0

| accepted

Answered
Matlab adds a minor number to integer - why?
"i noticed a very strange phenomanon:" Nope, not strange at all. "what is the "3" in the end..." Accumulated floating point e...

19 Tage ago | 1

Answered
Variable changes to previously calculated value each iteration.
This is very easy with a preallocated vector (giving exactly the values as you stated here): X = 100:440; N = numel(X); Z = n...

19 Tage ago | 0

| accepted

Answered
The usage of [~,I]=min(abs(A+B)) on a specific example
I don't really see how min can help you. Basic logical indexing would be simpler, e.g.: >> nnz(u<umin | u>umax) ans = 4 Note...

19 Tage ago | 0

| accepted

Load more