Réponse apportée
Creating a function that outputs a polynomial
tip: When you create a new function on matlab (right click directory>new file > function), it looks something like this: functi...

plus de 7 ans il y a | 0

Réponse apportée
Is there any function for calculating the size of a position vector in matlab?
use the norm() function. example: norm([1 2 3]) ans = 3.7417

plus de 7 ans il y a | 0

Réponse apportée
How to create variable to use on more than one function in App Designer?
https://www.mathworks.com/help/matlab/creating_guis/share-data-across-callbacks-in-app-designer.html you can store values in th...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
how to cause a change in the colour of a push button every time it is pressed ?
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
Extract data from array at set intervals to new array
you can use indexing. y(1:23:end)

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to create a random number that is a percent of each element in a vector
here's a small example: a = [100 200 300 400 500; 600 700 800 900 1000] bet = []; for i = 1:size(a,2) %for the number of colu...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Matrix dimension must agree
you are not using rand correctly. from the documentation: "X = rand returns a single uniformly distributed random number in the...

plus de 7 ans il y a | 0

Réponse apportée
How to joint together two matrix?
A =[4 4 4 4 ;3 3 3 3;2 2 2 2;1 1 1 1]; B = repmat(1:4,4,1); C = cell(1,numel(A)); for i = 1:numel(A) C{i} = [A(i) B(i)...

plus de 7 ans il y a | 0

Réponse apportée
How does I bring the line plot in front of the bar?
Use uistack(); a = plot(x,y) %let a be the handle to plot 1 b= plot(x2,y2) %let b be the handle to plot 2 uistack(a,'top') ...

plus de 7 ans il y a | 5

| A accepté

Réponse apportée
Index in position 1 is invalid. Array indices must be positive integers or logical values.
this line may be the cause: bar(bi, pc(ctx(i), choices(j))); because for i = 1, ctx(1) = 0. you cant index pc...

plus de 7 ans il y a | 0

Réponse apportée
Adjust size of vector/matrix
f you want to set the first 50 elements of B to be equal to A: B(1:50) = A; If you mean to delete excess elements in B until y...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How can I handle visibility on/off for plot function?
For graphic objects, there is a 'Visible' Property that you can adjust. If you have a handle for your line object, for example:...

plus de 7 ans il y a | 2

Question


Table elements not updating automatically-- bug or setting? (R2018a)
I have a variable window open that is a table displaying my x y data. Sometimes it updates as I change the x y values, but there...

plus de 7 ans il y a | 1 réponse | 0

0

réponse

Réponse apportée
Need help creating a two separate matrices; one matrix is a 5x5 and has ones in columns 1, 3, and 5. The other matrix is also 5x5, but in the elements in the fifth column are equal to the row number that they are on.
if you're looking for hints, check out the functions: size() ones() zeros() and this documentation on array indexing: https...

plus de 7 ans il y a | 0

Réponse apportée
plot in predesigned figure
You can assign a handle to the axes of the figure, and reference them in your plot function. for example: fig1 = figure; a = ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Matrix multiplication and addition
m1 = a(:,6); m2 = b(1:4,:)'; prod = m1.*m2; part_sums = sum(prod); r = part_sums(1); s = part_sums(2); ...

plus de 7 ans il y a | 0

Réponse apportée
How to get consistent subplot widths with legend outside?
You can assign a handle to the legends and set all their xpositions to be the same. Do the same for the subplots. ex: %some_x_...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
graph multiple fields in a struct
fld = fieldnames(variable); %list of all field names.. data1, data2,data3... for i = 1:numel(fld) % for each field name ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Can I create points on polygon with specific distance between them?
depends if your y values are equally spaced in the first place. Is this an appropriate workaround?: % add this to your plot h...

plus de 7 ans il y a | 0

Réponse apportée
How do I make a code that store large amount of information from excel into a matrix?
Are you trying to do this: m = numData1(:,[1:12]); this should give you a matrix with the first row corresponding to the eleme...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
I have a matrix (57,3600,45), how can I create matrices with (3600,45)?
does this give you what you want? test_num = 1; M(test_num,:,:) %where M= your matrix

plus de 7 ans il y a | 0

Réponse apportée
greater than less than
here's an example: voltsadd_val = [1 5 3; -2 -5 5; 1 -5 3]; voltsadd_val(voltsadd_val>0) = 1; % if pos, 1 voltsadd_val(voltsa...

plus de 7 ans il y a | 0

Réponse apportée
I'm trying to create a shopping list using buttons and am having trouble getting my list to stack items
some suggestions: function oatmeal_fn(Oatmeal_h, evt, TOTAL) % i would remove TOTAL if you could, ...

plus de 7 ans il y a | 0

Réponse apportée
How to Rearrange a Matrix
% let M be your matrix of two columns ind = [2 4 6 7 8 12]; % desired indices new_M = M(ind,:)

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How can I generate an array of binary data of this form?
N = 18; M = zeros(N); %preallocate space for i =1: size(M,1) ind = randperm(N); % generates random indices between 1:N ...

plus de 7 ans il y a | 1

Réponse apportée
Computing the median of a group except one member
Hello! Is this sort of what you're looking for? M=[1 2 3 6 5 4 2 3 4 1 5 6; 1 1 1 1 1 1 2 2 2 2 2 2; 2 4 6 5 7 8 3 7 5 7 5 3]'...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
Trouble displaying the final count
just do this: search = 'CAT'; locate = regexp(DNA,search) count = numel(locate{1}) %number of times CAT appears edit: it s...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How can I make a push button in a uitable?
There is a callback property for the uitable called 'CellSelectionCallback' which will trigger a function each time you select ...

plus de 7 ans il y a | 1

| A accepté

Question


Using cellfun() to set cell array of graphic objects 'Visible' Property to 'off'
I have a 1xn cell array of graphic objects-- currently I have the logic in a for-loop for j = 1:numel(uis) uis{j}.Visible ...

plus de 7 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
How to half the value of a constant inside an iteration?
maxiter = 100; iter = 1; x = 1:1:99; n = 8*(1/2).^x; % n = 8 , 4, 2, 0.5,... while iter< maxiter gamma = 10 * 10^(-n(it...

plus de 7 ans il y a | 0

| A accepté

Charger plus