Respondida
Ordering vectors of numbers of type double and strings according to another vector
vector_1 = [1 3 7 8 9 10]; string_1 = {'apples' 'pears' 'plums' 'oranges' 'peaches' 'grapes'}; vector_1_reordered = [3 1 7 9...

más de 3 años hace | 0

| aceptada

Respondida
Can't get the legend right
One way is to pass the graphics objects (i.e., lines, etc.) in as inputs to legend: figure() h1 = plot(1:10); hold on h2 = p...

más de 3 años hace | 0

| aceptada

Respondida
Zooming in on generated graph in order to get input value for a prompt
By default, inputdlg creates a modal dialog box (modal meaning no other figure/window can be interacted with while the modal one...

más de 3 años hace | 0

| aceptada

Respondida
specify grey color in two plots that share same x axis
There is a way to do that in one line of code: TimeVector = 0:10; LPr = [1:6 5:-1:1]; LP_rms = 3*ones(1,11); set(subsref(p...

más de 3 años hace | 1

| aceptada

Respondida
I am having this error, could you help?
a=1.6; b=0; x=[1.28 1.36 2.47 3.68 4.56]; y=a.^(x.^2-1)-log(x.^2-1)+(x.^2).^(1/3); y

más de 3 años hace | 0

Respondida
Function with input argument an integer n greater than 1 and output argument a column vector n
How about this? function v = ent_col(n) v = (0:n-1).'; % v(k) == k-1 ~= k end

más de 3 años hace | 1

| aceptada

Respondida
How to add a condition in programming coding ?
Put all the deleted rows in another matrix, and append them to the end of Co1ap1{v} after the while loop: % setting up the exam...

más de 3 años hace | 0

| aceptada

Respondida
How to save the output of each loop in .csv file?
writematrix(output, sprintf('Output_%d.csv',i))

más de 3 años hace | 1

| aceptada

Respondida
Modify axis label for each plot within loop
z = 2.1; ylabel(sprintf('z = %.2f',z)) See: sprintf

más de 3 años hace | 0

| aceptada

Respondida
How do I change the interval on one of my axis at different points along the axis?
Maybe this will be good enough: set(gca(),'XScale','log')

más de 3 años hace | 0

Respondida
How to write a mixed data (number and {real, imag}) in a CSV file ?
Does this work for you? matrix1 = {10;20;30}; matrix2 = [ { 2.3027900000000e-03, 2.0292300000000e-11};{ 8.6489600000000e-03...

más de 3 años hace | 0

| aceptada

Respondida
How do I make a new matrix for each iteration of a for loop?
mMode = cell(1,numel(snames)); for ii = 1:numel(snames) mMode{ii} = []; % put a matrix or whatever you want into mMode{i...

más de 3 años hace | 0

Respondida
Help changing camera related properties of the axes
camva(maze_axes,'manual') % CameraViewingAngleMode campos(maze_axes,'manual') % CameraPositonMode set(maze_axes, ... 'Ca...

más de 3 años hace | 0

Respondida
Matrix using for loop
M = 128; K = 5; P1 = zeros(M*K); for u = 0:K-1 for v = 0:K-1 p = 1/sqrt(K) * exp(-1i*2*pi*u*v/K) * eye(M); ...

más de 3 años hace | 1

| aceptada

Respondida
Adding multiple labels to a graph
s = [1 2 3 4 6 7 8 10]; t = [3 3 4 5 7 5 9 11]; G = digraph(s,t); h = plot(G); % schedule = [0 0 1 2 3 1 2 2 3 2 3]; yd =...

más de 3 años hace | 1

| aceptada

Respondida
Using for loop to generate and store matrix array and plot each cell
% Analytical clear all;clc;close all I = eye(4); A = [0 1 0 0;0 0 -4.91 0;0 0 0 1;0 0 73.55 0]; t0=0; tf=2; t = t0:0.01:...

más de 3 años hace | 0

| aceptada

Respondida
Arrays have incompatible sizes for this operation
Don't use == for comparing character vectors; use strcmp (or strcmpi), e.g.: if strcmp(pipe,'copper') elseif strcmp(pipe...

más de 3 años hace | 0

Respondida
How to iterate through a column vector elements one by one?
v = rand(1382,1); % 1382x1 column vector N = numel(v); final_result = zeros(N,1); % "another variable", the same size as v ...

más de 3 años hace | 0

Respondida
Convert a (rather complex) text file to mfile
"I have a text file ... I need to convert this into an mfile" m-files are text files, so you just need to change the extension ...

más de 3 años hace | 1

| aceptada

Respondida
What is the proper way to address this array when using an if-then statement with logical operators?
[m,n] = size(ratn); C1 = zeros(m,n); C2 = zeros(m,n); C3 = zeros(m,n); C4 = zeros(m,n); idx = ratn < 2 & ratn >= 0.1; ...

más de 3 años hace | 0

| aceptada

Respondida
Disabling Multiple uicontrol Buttons using array
Yes. For instance to disable all uicontrols in column 3 of grid: set([grid{:,3}],'Enable','off') By the way, you can store uic...

más de 3 años hace | 2

| aceptada

Respondida
This code only run and only exit button can be seen. and also I dont know what to change. what should I do please help me. Thank you
Looks like you have inadvertently placed uipanels on top of two of your uicontrols, obscuring them. I've modified the .fig file ...

más de 3 años hace | 0

Respondida
Return filtered values from a matrix
data = [321 -0.2; 937 -0.18; 23 -0.16; 472 -0.15; 964 -0.14; 375 -0.13; 902 -0.12; 462 -0.11; 842 0; 735 1; 328 2; 341 2.5; 421 ...

más de 3 años hace | 0

| aceptada

Respondida
Populate a matrix with values at certain i,j's
A = ones(57); A(4,6) = 0; A(8,9) = 0;

más de 3 años hace | 0

Respondida
Populate a column vector with values from another column vector
B = zeros(57,1); % 57x1 column vector B([4 5 7 10 11 13:end]) = A;

más de 3 años hace | 0

Respondida
How to plot a semi-circle on the horizontal axis in MATLABs & How to shade half the cirlce?
Npts = 101; r = 2; c = [0 0]; theta = linspace(0,pi,Npts); x = c(1) + r.*cos(theta); y = c(2) + r.*sin(theta); fill([x...

más de 3 años hace | 0

Respondida
error using patch vectors must be same length
It may be that y_avg_minus_reverse is longer than y, having been defined as longer in a previous run of the script, since the sc...

más de 3 años hace | 0

Respondida
Vertcat, I think I need to have consistent rows and columns, erroring out on B matrix creation. Can anyone show me how to make this correct?
Try this: n_col = size(AG2,2); B=[m2*AG2(1,:) m2*AG2(2,:) I2*alpha2*ones(1,n_col) m3*AG3(1,:)-force(1...

más de 3 años hace | 0

Respondida
Backward stairs plot in MATLAB
x = 1:8; y = [3 1 4 3 7 3 4 2]; stairs(flip(x),flip(y),'-b') hold on stairs(x,y,'--r') legend('Backward','Normal') y...

más de 3 años hace | 1

| aceptada

Respondida
Calling a specific value from a matrix using a loop
vals = [5 15 30 50]; idx = ismember(att_power(:,1),vals); result = att_power(idx,2)

más de 3 años hace | 0

| aceptada

Cargar más