Réponse apportée
Reodering/Swapping Arrays in a struct
You seem to be writing matlab code using C syntax. In matlab if conditions don't need to be enclosed in () brackets if a(i) > 7...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Are MATLAB updates supersed each other or we must install the whole packages?
Each update includes all the previous updates, you only need to install the latest even if you haven't installed the previous on...

plus de 6 ans il y a | 0

Réponse apportée
How to convert a letter to a number in a cell array? Number = alphabetical order location. i.e. A = 1, B = 2, C = 3, etc.
cell2mat(yourcellarray) - 'A' + 1

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
using strrep multiple times
Use replace instead: >> usertext = 'left black left right up down upside white upleft'; >> replace(usertext, {'left', 'up', 'b...

plus de 6 ans il y a | 3

Réponse apportée
How can I pass variables to eval without error suppression ?
f = @() func(numel(b), a, b); %prepare function for call evalc('f()'); %call function. () optional but make it clear we're ca...

plus de 6 ans il y a | 3

| A accepté

Réponse apportée
Find the orientation of each arbitrary object in an image
The structure (or table if you ask for table output) returned by regionprops has a field called 'Orientation' which is the angle...

plus de 6 ans il y a | 1

Réponse apportée
Select elements of a matrix based on the values of a logical array
First, have you noticed that your code doesn't work at all? It either copy all of columns 3 and 4 of A into C if B is all 1s, an...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Select specific number of random ones placed in a zeros matrix
m = zeros(1024, 1024); m(randperm(numel(m), 20)) = 1; %place 20 ones randomly in m.

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
how to read a string
split = textscan(tline, '%s%f%f%f'); txt = split{1} numbers = cell2mat(split(2:end))

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How do I track the number of instances of a given handle?
I'm curious what you mean by "inheriting that class appears to put a lot of constraints on what I can do with my existing code i...

plus de 6 ans il y a | 0

Réponse apportée
How to get field value from a struct as a variable in order to use in a code?
There's no need to. Creating separate variables is usually not a good idea. Wherever you were going to use X, use yourstruct.X. ...

plus de 6 ans il y a | 2

| A accepté

Réponse apportée
Having trouble finding the mean of array elements between two indices
See my comments to the question. Using a matrix, and assuming you're using R2019b since you haven't indicated a matlab version:...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Add empty cell inside a cell array considering a single array
Surely, by now, with all the questions you've asked, you should be able to manipulate cell arrays yourself. Anyway: desiredlen...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Is it possible to use a variable name like this within Matlab?
Confusingly, variable names can mean two different things now in matlab. A generic variable name, e.g. >> A = 5 is limited to ...

presque 7 ans il y a | 2

| A accepté

Réponse apportée
Why the threshold is 0.90 used to obtain the white component from RGB channels ?
You will have to ask whoever wrote that code why they chose that threshold. Most likely, the answer will be : because it worked...

presque 7 ans il y a | 0

Réponse apportée
How to index something based on numbering order???
Here is one way: %input x = [2; 3; 7; 5; 1] %generate random matrix without worrying about the order A = rand(size(x, 1),...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to assign specific colors to every quiver?
I can't remember if quiver did have children before R2014b (when the graphics system changed drastically) but since R2014b it do...

presque 7 ans il y a | 0

Réponse apportée
Why is my regular expression always greedy?
Matlab regex engine has the odd peculiarity that . also matches \n by default, whereas other engines don't. So your greedy .* in...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
Using data from a cell
I need new variables created for each of the character vectors No! As Stephen already told you this would worst way to go about...

presque 7 ans il y a | 0

Réponse apportée
How to create a new table array combining the values every n,th element from two different table arrays
In my case I would like to add every 60 values of A to add 59 consecutive values of B So, assuming that A and B are indeed vect...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
mod gives incorrect result
See my comment to Kalyan's answer for why your naive attempt doesn't work, and learn about floating point numbers so that you ca...

presque 7 ans il y a | 2

Réponse apportée
How do I get my matrix dimensions correct?
t_loading, v_trailertank, and co. (the random variables) are column vectors 1000 rows by 1 columns. To these you are adding x./...

presque 7 ans il y a | 0

Réponse apportée
Use rowfun to sum multiple columns by group
rowfun is not the correct function for this. rowfun applies the function by rows and consider the input variables as separate in...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
"Index exceeds the number of array elements (11)."
You create a variable called disp: disp = 'RLC Circuit' %removed brackets which didn't anything Which shadows the built-in ...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
What is the default varargin in the GUI callbacks? What are the differences between varargin{1} and varargin{2}.Source?
Yes, as Stephen says in his very thorough comment, that advice is utter rubbish. Don't do that it pointlessly obfuscate the code...

presque 7 ans il y a | 0

Réponse apportée
I have a Table in MATLAB. In one colum, lots of texts are seperated in comma. I wish to delimate those in seperate colums.
It's not clear what you want as an output since for each row you're going to get a different number of elements after the split....

presque 7 ans il y a | 0

| A accepté

Réponse apportée
mat lab terms of use
For this you should contact Mathworks directly. We're just a bunch of volunteers here.

presque 7 ans il y a | 0

Réponse apportée
Create an array iterating on another array
If I understood correctly: out = zeros(size(N)); for row = 1:size(N, 1) [isfound, where] = ismember(SP, G{row}(1, :)); %...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Create new .wav files around findpeak outputs
Here's how I'd do it: infile = 'C:\somewhere\somefolder\test_100m.wav'; %I'd recommend you use full path instead of relying on...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
calculating the number of days within each month for a range of dates
You've got to learn to work with datetime arrays. There's no need to use datenum to construct datetimes, and adjusting the defau...

presque 7 ans il y a | 0

| A accepté

Charger plus