Answered
Anyone know how to assign unique line colors in a plot call when there are a dozen or more data vectors?
Creating a map of maximally distinct colors is not a trivial task (as many people think), but luckily you can find some tools on...

18 Tage ago | 0

| accepted

Answered
comparing strings in alphabetical order
Simpler and more robust: S1 = 'banana'; S2 = 'apple'; [~,X] = sort({S1,S2}) Z = diff(X)

19 Tage ago | 1

Answered
Sorting 3 structures together
"I coluldnt think of how to start...." If you want to sort something, the best place to start is to read the sort documentation...

19 Tage ago | 0

| accepted

Answered
How to append two datas of two different .mat files into one .matfile?
It is very easy to efficiently create the union of two .mat files: >> copyfile('A.mat','C.mat') % C will be the merged file >>...

19 Tage ago | 1

Answered
Sum of matrix elements
>> k = cumsum(p) k = 4 13 16 19 25 33 41 53 59

19 Tage ago | 1

| accepted

Answered
how to convert uint32(4294967278) to -16
>> typecast(uint32(4294967278),'int32') ans = -18

19 Tage ago | 0

| accepted

Answered
How to Permute the array with specific number?
>> b = [1,5,2,8,6,11,7,9,3,10]; >> idx = ~ismember(b,[1,2,6,7,9,10]); >> mat = repmat(b,factorial(nnz(idx)),1); >> mat(:,idx)...

20 Tage ago | 0

| accepted

Answered
Is Walter Roberson a real person, or is he some kind of Matlab AI robot?
https://en.wikipedia.org/wiki/Watson_(computer) Walter <-> Watson Levenshtein distance = 4. Roberson <-> Robot ...

20 Tage ago | 5

| accepted

Answered
Convert matlab zeros function to Python equivalent
You need to read the numpy zeros documentation, because your syntax does not actually match its specification: import numpy as ...

20 Tage ago | 0

Answered
merging vectors together with alternating values
>> A = [1;2;3;4]; >> B = [5;6;7;8]; >> C = [A(:);B(:)]; >> C([1:2:end,2:2:end]) = C C = 1 5 2 6 3 7 ...

20 Tage ago | 0

Answered
Extrac Part of a cell array
>> a = {'danny_820','richard_320','Tom_500','Fred_120'}; >> str2double(regexp(a,'\d+$','once','match')) ans = 820 320 ...

21 Tage ago | 0

Answered
String Search with Special Characters
You can use tokens to identify the specific substrings and get their locations: >> S = '>ABCD 2345678.123<'; >> [T,X] = regexp...

21 Tage ago | 1

Answered
How to find where are the location of the original values after the matrix was sorted
>> old = randi(9,6,4) % fake data old = 8 6 3 6 1 4 9 4 8 1 4 8 6 3 8 7 3 8 4 ...

21 Tage ago | 0

| accepted

Answered
If statement using vectors
You cannot use if like that to operate element-wise on arrays (read the if help to know what your code is actually doing). You c...

23 Tage ago | 0

| accepted

Answered
The variables which were stored in handles gets deleted once the program control gets out of the function loop despite using guidata()
You need to call guidata inside processe. In its current location, your first guidata does nothing. num=processe(hObject, handl...

24 Tage ago | 0

Answered
How can I extract a variable that is calculated inside an ode function and pass it as an input to the event function?
The simplest solution is to use nested functions: https://www.mathworks.com/help/matlab/matlab_prog/nested-functions.html Basi...

24 Tage ago | 0

| accepted

Answered
How to create the array [1, 2,2 ,3, 3, 3, 4,4 4, 4]?
>> V = 1:10; >> floor(sqrt(2*V)+1/2) ans = 1 2 2 3 3 3 4 4 4 4

24 Tage ago | 0

| accepted

Answered
Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use '=='.
The actual problem starts on this line: f=@(t,z)[ ... because your code is missing the matching ] Using = was correct. Note ...

25 Tage ago | 1

| accepted

Answered
How to extract values from a string.
>> S = 'Delft_2_220_20_4344-5088.csv'; >> V = str2double(regexp(S,'\d+','match')) V = 2 220 20 ...

25 Tage ago | 1

| accepted

Answered
How to find line of code that prints ans
Method one The MATLAB editor already identifies (most of) these lines for you! This is one of the many helpful features that t...

25 Tage ago | 1

Answered
Problem with my if else command
An IF statement is not appropriate (without a loop). The simple MATLAB way is to use indexing: >> a = 1; >> b = 1; >> x_15 = ...

25 Tage ago | 1

| accepted

Answered
Not equal operator not working on matrix size
"Why does == work as expected, but ~= doesn't?" They both work exactly as expected. "Did I make a mistake?" The IF documentat...

25 Tage ago | 2

| accepted

Answered
Transform NaN into number
Your original description failed to mention several things, including the size of the numeric vector and also that the numeric v...

25 Tage ago | 1

Answered
creating a vector from a bin count
R2015a or later: >> M = [0 5; 1 2; 2 1]; >> repelem(M(:,1),M(:,2)).' ans = 0 0 0 0 0 1 1 2 ...

26 Tage ago | 1

| accepted

Answered
displaying matrix in .txt file (fprintf)
No loop required: mat = [1,1,1,1;0,-49+4i,-49-4i,-52;0,-2417,-2417,-2392;0,-117649-64i,-117649+64i,-117676]; fmt = ' |%.2f%+.2...

26 Tage ago | 0

Answered
How to create an empty struc with fields of a given struct?
The simplest and most efficient solution to the question posed is to just use indexing, e.g.: >> A(1).x = 1; >> A(1).y = 2; >...

26 Tage ago | 1

Answered
How do I get a bar chart in the newest version but with the colors from an older version?
"I have not been able to locate a definitive answer to what the default colors are for a bar chart." The bar documentation stat...

26 Tage ago | 0

| accepted

Answered
Calling a function in MATLAB
To call a function or a script, just write its name with the necessary inputs: my_function(...) Or my_script This works in t...

26 Tage ago | 0

| accepted

Answered
Undesired behaviour of bsxfun and colon-operator
A robust workaround using ndgrid and arrayfun and exactly the same function: >> [X,Y] = ndgrid(1:3,6:9); >> arrayfun(@(x,y)x+s...

26 Tage ago | 0

| accepted

Answered
How can I create all possible random combinations of word pairs without having the same values (for example, house - house)?
Pick random rows from X to get the random pairs: >> Tile = {'house', 'core', 'word', 'ask', 'question', 'horse', 'phone', 'eyes...

26 Tage ago | 0

| accepted

Load more