Answered

How can write multiple Excel sheets into one excel file?

I do not know if this is best way, but try this after your for loop: C = cellfun(@table2cell,T,'UniformOutput',false); % Conver...

How can write multiple Excel sheets into one excel file?

I do not know if this is best way, but try this after your for loop: C = cellfun(@table2cell,T,'UniformOutput',false); % Conver...

19 jours ago | 1

| accepted

Answered

Data type conversion help

A cell or table is a wrapper for the data. You can't compare the cells or tables, you want to compare data inside the cell or t...

Data type conversion help

A cell or table is a wrapper for the data. You can't compare the cells or tables, you want to compare data inside the cell or t...

6 mois ago | 1

Answered

Converting a cell array into a matrix of stipulated number of columns and rows

wid = [W{1}(:) W{2}(:) W{3}(:) W{4}(:)];

Converting a cell array into a matrix of stipulated number of columns and rows

wid = [W{1}(:) W{2}(:) W{3}(:) W{4}(:)];

7 mois ago | 0

Answered

Plotting of 15 years data on same graph.

Try something like this: fid = fopen('Mod21_All_Inclusive_Data_Nov2019.txt'); Mod = textscan(fid,'%s %s %n %n'); fclose(fid);...

Plotting of 15 years data on same graph.

Try something like this: fid = fopen('Mod21_All_Inclusive_Data_Nov2019.txt'); Mod = textscan(fid,'%s %s %n %n'); fclose(fid);...

7 mois ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

So you are insexing al by c (al(c)), but al is a constant so only has one element. This should fail on loop 2. Did you mean: h1...

Unable to perform assignment because the left and right sides have a different number of elements.

So you are insexing al by c (al(c)), but al is a constant so only has one element. This should fail on loop 2. Did you mean: h1...

7 mois ago | 0

| accepted

Answered

xlswrite over for loop

This will save out all the results in one excel: output_mat = cell(numel(parameter_list),5); for j=1:numel(parameter_list...

xlswrite over for loop

This will save out all the results in one excel: output_mat = cell(numel(parameter_list),5); for j=1:numel(parameter_list...

7 mois ago | 0

| accepted

Answered

Importing data to change a NaN

Try readcell: RD = readcell('filename.xlsx') choice = 1 avg = mean([RD{choice,2:end}]); name = RD{choice,1}; disp([name '...

Importing data to change a NaN

Try readcell: RD = readcell('filename.xlsx') choice = 1 avg = mean([RD{choice,2:end}]); name = RD{choice,1}; disp([name '...

7 mois ago | 0

Answered

Iteration cycle of a code

Can you show your code? Make sure you are initally setting A before the for loop. If I am understanding the problem, it should l...

Iteration cycle of a code

Can you show your code? Make sure you are initally setting A before the for loop. If I am understanding the problem, it should l...

7 mois ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements. Is it due to the vector stuff? How to solve it. Thanks in advance

I has the size of 2x(length(a)). When you are setting I you are only indexing the second dimension. What is the size of sys.Mea...

Unable to perform assignment because the left and right sides have a different number of elements. Is it due to the vector stuff? How to solve it. Thanks in advance

I has the size of 2x(length(a)). When you are setting I you are only indexing the second dimension. What is the size of sys.Mea...

7 mois ago | 0

| accepted

Answered

Converting date times into periods, day, month

I would try something like this: T = table(); [~,T.Month,T.Day] = ymd(FC.StartDateTime); [h,m] = hms(FC.StartDateTime); [~,T...

Converting date times into periods, day, month

I would try something like this: T = table(); [~,T.Month,T.Day] = ymd(FC.StartDateTime); [h,m] = hms(FC.StartDateTime); [~,T...

8 mois ago | 0

| accepted

Answered

loop over branch of subfolders to copy files, without pattern in file name, in folders with specific name scheme

Are you trying to do something like this? outputFolder = fullfile(pwd, 'image_sorted') if ~exist(outputFolder, 'dir') mkdir...

loop over branch of subfolders to copy files, without pattern in file name, in folders with specific name scheme

Are you trying to do something like this? outputFolder = fullfile(pwd, 'image_sorted') if ~exist(outputFolder, 'dir') mkdir...

8 mois ago | 0

Answered

How to modify the colobar settings?

You could try this: c = colorbar; units = ' m'; c.TickLabels{end} = [c.TickLabels{end} units]; c.Location = 'westoutside';...

How to modify the colobar settings?

You could try this: c = colorbar; units = ' m'; c.TickLabels{end} = [c.TickLabels{end} units]; c.Location = 'westoutside';...

8 mois ago | 1

| accepted

Answered

How to modify the colobar settings?

c = colorbar; units = 'm'; c.TickLabels = cellfun(@(x) [x ' ' units], c.TickLabels, 'UniformOutput', false) c.Position = [lef...

How to modify the colobar settings?

c = colorbar; units = 'm'; c.TickLabels = cellfun(@(x) [x ' ' units], c.TickLabels, 'UniformOutput', false) c.Position = [lef...

9 mois ago | 1

Answered

Adding new column of data from loop

x = nan(10,num_loops); for n = 1:num_loops v = %some code that ouputs a 1 row 10 column data set say [1;2;3;4;5;...10] ...

Adding new column of data from loop

x = nan(10,num_loops); for n = 1:num_loops v = %some code that ouputs a 1 row 10 column data set say [1;2;3;4;5;...10] ...

9 mois ago | 1

| accepted

Answered

How to merge multiple xyz files into 1 large array

Not all the cells in AIS_SEC are structures. For example AIS_SEC{1,33} is a cell array with a string in it. You can skip those ...

How to merge multiple xyz files into 1 large array

Not all the cells in AIS_SEC are structures. For example AIS_SEC{1,33} is a cell array with a string in it. You can skip those ...

9 mois ago | 1

Answered

How to find files with a given pattern in multiple folders

Try contains: function filefinder(file, directory) % List of the predefined directories to look into if nargin == 1 di...

How to find files with a given pattern in multiple folders

Try contains: function filefinder(file, directory) % List of the predefined directories to look into if nargin == 1 di...

9 mois ago | 0

Answered

How to plot a graphic with different markers in a scatter plot?

Is this what you mean? This is assuming that a,b,c,d,e,f are 3 element vectors. clear; load -ascii test1.txt; a=test1(:,1...

How to plot a graphic with different markers in a scatter plot?

Is this what you mean? This is assuming that a,b,c,d,e,f are 3 element vectors. clear; load -ascii test1.txt; a=test1(:,1...

9 mois ago | 0

| accepted

Answered

How to flip an axis on a plot without affecting the plot?

Try: axis(gca,'ij')

How to flip an axis on a plot without affecting the plot?

Try: axis(gca,'ij')

9 mois ago | 0

| accepted

Answered

Average of multiple matrices to create a new matrix with the same dimension.

If I am understanding your question right, you are wanting to find average of each element and ignore the nans? diret = 'New Fo...

Average of multiple matrices to create a new matrix with the same dimension.

If I am understanding your question right, you are wanting to find average of each element and ignore the nans? diret = 'New Fo...

9 mois ago | 1

| accepted

Answered

If statement "if column 1 == column 2 then keep row"

Have you tried something like this? subData = data(colA == colB);

If statement "if column 1 == column 2 then keep row"

Have you tried something like this? subData = data(colA == colB);

9 mois ago | 0

Answered

Puting empty value in numeric array

How about putting a NaN in it? Data(n,1)= NaN;

Puting empty value in numeric array

How about putting a NaN in it? Data(n,1)= NaN;

9 mois ago | 2

| accepted

Answered

How to store vectors from each for loop in a matrix

if true X= 1:0.1:2; A = 4; B = 1:5; Y = nan(length(X),length(B)); for i = 1:length(X) Y(i,:) =...

How to store vectors from each for loop in a matrix

if true X= 1:0.1:2; A = 4; B = 1:5; Y = nan(length(X),length(B)); for i = 1:length(X) Y(i,:) =...

9 mois ago | 0

| accepted

Answered

Array indices must be positive integers or logical values.

I ran your code and it works for me. This leads me to believe you might have a variable in your workspace named min. Try this: ...

Array indices must be positive integers or logical values.

I ran your code and it works for me. This leads me to believe you might have a variable in your workspace named min. Try this: ...

9 mois ago | 0

| accepted

Answered

List comprehension-like function in assigning values in nested structures

Try this: h = [data.h];

List comprehension-like function in assigning values in nested structures

Try this: h = [data.h];

9 mois ago | 1

| accepted

Answered

Why is this not outputting anything?

For this to work you need to set your intial MIN_VALUE to inf rather than 0. If its set to zero, it will only make output if you...

Why is this not outputting anything?

For this to work you need to set your intial MIN_VALUE to inf rather than 0. If its set to zero, it will only make output if you...

9 mois ago | 0

| accepted

Answered

Error storing structure within parfor

You could try storing it in a cell array and converting to structure after the parfor: names = cell(num_sim,1); results = cell...

Error storing structure within parfor

You could try storing it in a cell array and converting to structure after the parfor: names = cell(num_sim,1); results = cell...

9 mois ago | 0

| accepted

Answered

Why is this matrix instantly forming in the middle of the for loop?

When you calculate S_2, M_0 is subtracted in last part of the equation making it a 1x30 matrix. Should you be subtracting M_0(i)...

Why is this matrix instantly forming in the middle of the for loop?

When you calculate S_2, M_0 is subtracted in last part of the equation making it a 1x30 matrix. Should you be subtracting M_0(i)...

9 mois ago | 0

| accepted

Answered

Make 1 figure with 2 plots in 1 row. First plot will be empty, and second plot will contain bar plot of all values of i from one of the above loops.

subplot(1,2,1); subplot(1,2,2); bar(i)

Make 1 figure with 2 plots in 1 row. First plot will be empty, and second plot will contain bar plot of all values of i from one of the above loops.

subplot(1,2,1); subplot(1,2,2); bar(i)

9 mois ago | 0

Answered

How to use cell as input arguments of a function?

This works for me. Maybe matlab has another merge function? Type this: which merge Make sure the path its giving you points at...

How to use cell as input arguments of a function?

This works for me. Maybe matlab has another merge function? Type this: which merge Make sure the path its giving you points at...

9 mois ago | 0

| accepted

Answered

comparison of vectors and reducing size

If you want to just keep the first 299 elements: sz = min([length(A),length(B),length(C)]); A = A(1:sz); B = B(1:sz); C = C(...

comparison of vectors and reducing size

If you want to just keep the first 299 elements: sz = min([length(A),length(B),length(C)]); A = A(1:sz); B = B(1:sz); C = C(...

9 mois ago | 1

| accepted