Community Profile

# Voss

Last seen: Today Active since 2013

Professional Interests:

All

View badges

#### Content Feed

View by

Answered
Sequencing a matrix with two constant variables and two incremental variables
Like this? max_num = 10; % change max_num to 100 if you want N to go up to 100 A = reshape(ones(1,max_num-3).'+(0:max_num-3)...

3 hours ago | 0

Answered
Importing multiple text files into MATLAB
The options you have available to you depend on the contents of your txt files, but one general option (i.e., will work regardle...

6 hours ago | 0

Answered
how to padding array with zeros to limit rows (I can choose the limit)
AB=[1 6 2 7 3 8 4 9 5 10]; AB(21,:) = 0; % MATLAB fills the intervening rows with zeros disp(AB);

8 hours ago | 1

Answered
How to plot a function on an existing plot
It seems to work ok. Here I'm using different data for the image because I don't have your txt files. % bandstructure.m (modifi...

8 hours ago | 1

| accepted

Answered
Create a time array
val = [ ... '17-10-58_086'; ... '17-11-09_923'; ... ] dt = datetime(val,'InputFormat','HH-mm-ss_SSS') dt_diff =...

9 hours ago | 0

Answered
Plot legend in a bar graph
Month = {'April'; 'May'; 'June'; 'July'; 'August'; 'September'; 'October'; 'November'; 'December';'January'; 'February'; 'March'...

9 hours ago | 1

Answered
How can I read CSV file and plot without removing header?
A = readtable('v1.csv') figure; plot(A{:,1},A{:,2},'-','LineWidth',1.5,'color',[30,129,176]/255); hold on; plot(A{:,1},A{:...

19 hours ago | 1

| accepted

Answered
if-elseif-else statement take turns/used each of them in while loop, how to write properly?
Like this? i=0; while i <= 20 i = i+1; r = rem(i,3); if r == 1 disp('its first num') elseif r == ...

19 hours ago | 0

Answered
How to store data from a nested For loop
x = -500:500:500; % X range y = -500:500:500; % Y range "The" MATLAB way: [xx,yy] = meshgrid(x,y); xy_coord = [x...

1 day ago | 0

Answered
how to store value in variables of one column in cell array from another column in cell array?
% your V_table: V_table = table( ... {'Lser_B7Tx';'Lser_B7Rx';'QCsmd';'QLemb';'Lshu_B7';'fQ';'Cshu_B7';'QLsmd'}, ... ...

1 day ago | 1

| accepted

Answered
How to multiply scalar and matrix(i set her in ''uitable1'') in GUI?
Use the Data property of the uitable data = get(handles.uitable1,'Data') There's no telling (based on the code we can see) wha...

1 day ago | 0

| accepted

Answered
Spit an array when the value 0 occurs until the value 2
% an array time (6700x1) containing numbers from % -8 to 5 in ascending order: time = linspace(-8,5,6700).' % time_new based...

1 day ago | 1

| accepted

Answered
Last value of Moving Average in single command
Here's a way: A = rand(10,1); % original, for reference: B = movavg(A,'exponential',2); C = B(end) % single-line command...

1 day ago | 0

Answered
How to store multiple iterations of a 3x3 matrix using a for loop.
Use a 3-dimensional array of size 3-by-3-by-n: t_0 = 0 t_finish = 120 n = 0 for int = t_0:t_finish n = n + 1 Cpp_...

1 day ago | 0

Answered
How to create answers to a calculation in an array in a forloop ?
Nbins = numel(edges)-1; BinSums = zeros(1000,Nbins); for jj = 1:1000 % ... % different a and b each time ...

1 day ago | 0

| accepted

Answered
Fill a column in a table with an array
% a table T of a certain height: T = table((1:10).',char((65:74).')) % a 1x1 duration array: D = duration() % populate a new...

1 day ago | 0

| accepted

Answered
Error setting property 'YLabel' of class 'Axes':
The YLabel is a text object. You mean to set its String property: figure; ax = gca; ax.YLabel.String = "[Pressure [Pa]]" ; ...

1 day ago | 1

| accepted

Answered
How to reshape any matrix using while loop or any other method?
Here's one way, based on the assumption that it goes A(:,[1,2,3,...,20,21,22,...]) = B(:,[1,7,13,...,115,2,8,...]) % 5x120 mat...

2 days ago | 0

| accepted

Answered
Loop with 2 diferent iterations conuntings
total_count = 0; conditional_count = 0; max_iter = 10000; for iter = 1:max_iter total_count = total_count + 1;...

2 days ago | 0

Answered
Finding if the value is present in the table using readtable
Try this: A = readtable('dataset1.xlsx'); % use 's' argument in input(), so that the user input % is stored directly in te...

2 days ago | 0

Answered
How to Extract 2048 values containing the maximum value?
"I want to plot only the largest 2048 values" A = readmatrix('Data2048.txt'); A = sort(A,'descend'); plot(A(1:2048))

2 days ago | 1

Answered
Error using / Matrix dimensions must agree
Use ./ r=linspace(-180,180,360); t=linspace(-180,180,360); [R,T]=meshgrid(r,t); % phi_=6*r*cos(1+5^2/R.^2)-T; phi_=6*r*cos(...

2 days ago | 0

| accepted

Answered
Index exceeds the number of array elements - Error message
Here's one way to determine the number of iterations required: clear all mdata = [1 2 3 4 5 6 7 8 9]; n1 = 1; k = 1; N ...

2 days ago | 0

| accepted

Answered
Colorbar from an array
unzip data.zip [A,R1] = geotiffread('MOD06_L2.A2018001.1500.CER.WGS84.RAMIS.tif'); A = uint16(A); brown_color = [0.5 0.2 0....

2 days ago | 1

| accepted

Answered
How can I plot square waves with an increasing/decreasing linear pattern?
%given k_num=-45.6992; h_num=60.3496; %plotting lines of triangle plot([k_num,0],[h_num,2*h_num],'m') hold on radius=sqr...

2 days ago | 0

| accepted

Answered
Creating xlsx with multiple sheets
Here's one way, demonstrated with random data (random DateNtime(:,2)): %% Define date&time arrays : t1 = datetime(2021,6,21,1,...

2 days ago | 0

| accepted

Answered
How to loop all slice locations from a image volume as a single column vector?
Move the last two lines inside the loop and assign info.SliceLocation to the kth element of slLoc: %% close all; clear; clc; ...

2 days ago | 0

| accepted

Answered
Datetime won't recognise some cells
load datetime-problem.mat databackup.TimeofDay % original Format specification: datetime(databackup.TimeofDay,'Format','HH:mm...

2 days ago | 1

Answered
How to retrieve index in a matrix
One way is to find the index of the minimum in each column of A one at a time, setting that row of A to NaN each time so that th...

2 days ago | 0

| accepted

Answered
plot using user custumized legend lines
The set of colors of the lines in the legend doesn't match with the set of colors of the circles because the xlines and ylines a...

2 days ago | 1

| accepted