**Statistics**

RANK**26**

of 271,662

REPUTATION**7,408**

CONTRIBUTIONS

**0** Questions

**2,440** Answers

ANSWER ACCEPTANCE **
0.00%
**

VOTES RECEIVED**652**

RANK

of 18,321

REPUTATION**N/A**

AVERAGE RATING**0.00**

CONTRIBUTIONS**0** Files

DOWNLOADS **0**

ALL TIME DOWNLOADS**0**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Use a for loop to generate function arguments

n = 50; data = cell(1,n); % cell array to contain the output from my_function for all iterations input_args = {}; % cell arra...

39 minutes ago | 0

Finding a variable in a large table

% a table with station names and other info: t = table(["Picadilly Circus"; "St. John's Wood"; "Cockfosters"],rand(3,1),rand(3,...

3 hours ago | 0

How can I get rid of the ---data1 after using legend code, I just want to keep the name of the planet?

In your call to legend, you can specify which graphics objects should be included in the legend, as shown in this question and a...

3 hours ago | 1

Offsetting the text coordinates on a plot

Making up some data: t1 = 5.9848; t2 = 7.623; t3 = 9.234; t4 = 10.982; t5 = 13.223; t6 = 14.765; t7 = 16.023; t8 = 18.12...

4 hours ago | 0

I need help rearranging values in a 2D Matrix to create contour plots

Try this: clc;clear; Uall=[]; Vall=[]; for i=0:798 temp_L=importdata(['Final Project Adaptive PIV.76m7uaui.', num2str(i...

5 hours ago | 0

Ignoring the line continuation (...) when reading a text file

You can rename the txt file to an m-file and run it like any other MATLAB script. The name of the m-file cannot be test.m in thi...

7 hours ago | 0

| accepted

Finding a value of one vector based on the nonzero values of another vector

A = A(B == 1)

17 hours ago | 0

Warning: Ignoring extra legend entries. How do I fix this?

When n == 1, bar() gives you a single series (update has one row): figure bar([2 3],'grouped') % notice: no orange bars as op...

21 hours ago | 0

| accepted

colorbar scale is not correct when using isosurface and patch plots

Is this how it should be? unzip('ne231.zip') Nx = 128; Ny = 128; Nz = 128; Lx =128; Ly = 128; Lz = 128; xi = ...

22 hours ago | 0

Is my code for this assignment correct?

You can construct a cell array more directly than that (which is not to say your approach is "incorrect"): S = {'Argentina' 'Bo...

1 day ago | 0

| accepted

using trapz in a for loop

When you call trapz with two arguments and the second argument is a scalar (like what happens in your loop when i == 1), then tr...

1 day ago | 0

Loop For extract maximum rows of matrix based on vectors

data = [ 1 3 4 1 5 4 1 6 4 1 2 4 1 1 4 2 4 4 2 4 4 2 4 4 2 4 4 2 5 4 1 1 4 1 1 4 1 2 4 1 3 4 1 5 4 2 5 4 2 5 4 ...

1 day ago | 0

| accepted

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...

1 day ago | 0

| accepted

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...

1 day ago | 0

| accepted

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...

1 day ago | 0

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...

1 day ago | 1

| accepted

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

1 day ago | 0

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

1 day ago | 1

| accepted

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...

1 day ago | 0

| accepted

How to save the output of each loop in .csv file?

writematrix(output, sprintf('Output_%d.csv',i))

2 days ago | 1

| accepted

Modify axis label for each plot within loop

z = 2.1; ylabel(sprintf('z = %.2f',z)) See: sprintf

2 days ago | 0

| accepted

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')

2 days ago | 0

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...

2 days ago | 0

| accepted

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...

2 days ago | 0

Help changing camera related properties of the axes

camva(maze_axes,'manual') % CameraViewingAngleMode campos(maze_axes,'manual') % CameraPositonMode set(maze_axes, ... 'Ca...

2 days ago | 0

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); ...

2 days ago | 1

| accepted

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 =...

2 days ago | 1

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:...

3 days ago | 0

| accepted

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...

3 days ago | 0

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 ...

3 days ago | 0