Answered

How can read 30 text data files in matlab ?

you can alwsay put all of them in a single directory, then use dir to get all file names and iterate through all of them: path ...

How can read 30 text data files in matlab ?

you can alwsay put all of them in a single directory, then use dir to get all file names and iterate through all of them: path ...

alrededor de 1 mes ago | 0

Answered

How to add a sequential number in a column of tables cell?

for i = 1:numel(Test) t = Test{i}; t.gridded_model = strcat(t.gridded_model, '_', num2str(i)); Test{i} = t; end

How to add a sequential number in a column of tables cell?

for i = 1:numel(Test) t = Test{i}; t.gridded_model = strcat(t.gridded_model, '_', num2str(i)); Test{i} = t; end

alrededor de 2 meses ago | 1

| accepted

Answered

Text file has headers that are 2X4 and are repeated randomly within the data.

str = fileread('MCT_Data.txt'); nums = cellfun(@str2double, regexp(str, '([\d.,]+)', 'match')); x = reshape(nums, 4, [])' x...

Text file has headers that are 2X4 and are repeated randomly within the data.

str = fileread('MCT_Data.txt'); nums = cellfun(@str2double, regexp(str, '([\d.,]+)', 'match')); x = reshape(nums, 4, [])' x...

alrededor de 2 meses ago | 0

| accepted

Answered

Converting all arrays inside a cell to tables

c = repmat({(1:10)'}, 3,3) c = 3×3 cell array Columns 1 through 2 {10×1 double} {10×1 double} {1...

Converting all arrays inside a cell to tables

c = repmat({(1:10)'}, 3,3) c = 3×3 cell array Columns 1 through 2 {10×1 double} {10×1 double} {1...

alrededor de 2 meses ago | 1

Answered

Error with find function in a for loop

Find accepts a logical vector and returns all the indices containing 1. The problem is you are giving find a scalar value so...

Error with find function in a for loop

Find accepts a logical vector and returns all the indices containing 1. The problem is you are giving find a scalar value so...

2 meses ago | 1

| accepted

Answered

How to plot colorbar as seperate image?

I assume your image is grayscale, right? If I understand you correctly: min_val=min(example_img(:)); max_val=max(example_img...

How to plot colorbar as seperate image?

I assume your image is grayscale, right? If I understand you correctly: min_val=min(example_img(:)); max_val=max(example_img...

2 meses ago | 1

| accepted

Answered

How to return no output in a function with output?

output variables, the same as input variables, are optional You can choose to return one, both or neither of your outputs. In ...

How to return no output in a function with output?

output variables, the same as input variables, are optional You can choose to return one, both or neither of your outputs. In ...

3 meses ago | 0

Answered

Can I run MATLAB code on a server?

I think this may be what you are looking for https://www.mathworks.com/help/compiler/webapps/install-matlab-web-app-server.html...

Can I run MATLAB code on a server?

I think this may be what you are looking for https://www.mathworks.com/help/compiler/webapps/install-matlab-web-app-server.html...

3 meses ago | 0

Answered

app designer private and public properties?

If these functions are methods of your app, you can use private properties from within these methods, but if they are functions ...

app designer private and public properties?

If these functions are methods of your app, you can use private properties from within these methods, but if they are functions ...

3 meses ago | 0

| accepted

Answered

Group cells in a matrix per column based on an indexed starting point

you can map the ends of each series of ones using diff: C = [diff(B, 1, 1) == -1; B(end, :)]; then check each occurence of C ...

Group cells in a matrix per column based on an indexed starting point

you can map the ends of each series of ones using diff: C = [diff(B, 1, 1) == -1; B(end, :)]; then check each occurence of C ...

3 meses ago | 0

Answered

Best practice for updating default parameter values inside a function, preferably with struct

Using assignin as your configuration strategy is a bad idea not only due to bad performance. It's also very prone to bugs. lets ...

Best practice for updating default parameter values inside a function, preferably with struct

Using assignin as your configuration strategy is a bad idea not only due to bad performance. It's also very prone to bugs. lets ...

3 meses ago | 1

| accepted

Answered

Cross tabulation row percentages

How about something like that? t{:,{'sale1','sale2'}} = t{:,{'sale1','sale2'}}./t.totalsales * 100 Given that t is your ...

Cross tabulation row percentages

How about something like that? t{:,{'sale1','sale2'}} = t{:,{'sale1','sale2'}}./t.totalsales * 100 Given that t is your ...

3 meses ago | 0

| accepted

Answered

Help me about my error on index in position 2 exceeds array bounds (must not exceed 800).

I have no idea what rm and cm are, but at some iteration y=(j-1)*8 + 8 is greater than the number of columns in your matrix u...

Help me about my error on index in position 2 exceeds array bounds (must not exceed 800).

I have no idea what rm and cm are, but at some iteration y=(j-1)*8 + 8 is greater than the number of columns in your matrix u...

4 meses ago | 0

Answered

How do I determine which row my value change significantly

Im assuming its roughly 375 and not exactly that value, otherwise go with Turlough Hughes' solution which is simpler. The eas...

How do I determine which row my value change significantly

Im assuming its roughly 375 and not exactly that value, otherwise go with Turlough Hughes' solution which is simpler. The eas...

4 meses ago | 0

Answered

How to plot a function with different values

You can make M a column vector, then calculate S as a matrix then if you plot it against t which is a row vector plot should tr...

How to plot a function with different values

You can make M a column vector, then calculate S as a matrix then if you plot it against t which is a row vector plot should tr...

5 meses ago | 1

| accepted

Answered

How to extract a value out of different .mat files and save them into an array

s = load('my_file_5.mat'); will return a struct, each variable in the file will be put in a field in that struct if all files ...

How to extract a value out of different .mat files and save them into an array

s = load('my_file_5.mat'); will return a struct, each variable in the file will be put in a field in that struct if all files ...

5 meses ago | 0

| accepted

Answered

Mean of the third dimension

try this: avgPerYear = nanmean(rain, [1,2]); that would generate an inconvenient 3rd dimention vector so you can reshape it i...

Mean of the third dimension

try this: avgPerYear = nanmean(rain, [1,2]); that would generate an inconvenient 3rd dimention vector so you can reshape it i...

6 meses ago | 1

Answered

how to find out how many columns have more than 50 elements which are greater than 1?

x = rand(100) * 2; atLeast50 = sum(x > 1, 1) > 50;

how to find out how many columns have more than 50 elements which are greater than 1?

x = rand(100) * 2; atLeast50 = sum(x > 1, 1) > 50;

6 meses ago | 0

Answered

Array indices must be positive integers or logical values.

in Matlab, matrix indices start from one, not zero like other programming languages, but your index starts from zero: colum-dtn...

Array indices must be positive integers or logical values.

in Matlab, matrix indices start from one, not zero like other programming languages, but your index starts from zero: colum-dtn...

7 meses ago | 0

Answered

Is there a faster way of splitting a cell array into numeric array while preserving NaN?

try this endsWithSemicolon = cellfun(@(s) endsWith(s, ';'), data); x = cellfun(@(s) textscan(s, '%f', 'Delimiter', ';', 'Empty...

Is there a faster way of splitting a cell array into numeric array while preserving NaN?

try this endsWithSemicolon = cellfun(@(s) endsWith(s, ';'), data); x = cellfun(@(s) textscan(s, '%f', 'Delimiter', ';', 'Empty...

8 meses ago | 2

| accepted

Answered

A question on regexprep

A is not a match for your regexp, match = regexp(s,'\<(\w)(\w*)(\w)\>', 'match') match = 1×5 cell array {'John'...

A question on regexprep

A is not a match for your regexp, match = regexp(s,'\<(\w)(\w*)(\w)\>', 'match') match = 1×5 cell array {'John'...

8 meses ago | 0

| accepted

Answered

What exactly is a StartPoint for a Curve Fitting Tool, its significance and how it works?

curve fitting works by trying to find the parameters of your model, lets say you are trying to fit a gaussian to a single peak c...

What exactly is a StartPoint for a Curve Fitting Tool, its significance and how it works?

curve fitting works by trying to find the parameters of your model, lets say you are trying to fit a gaussian to a single peak c...

8 meses ago | 1

| accepted

Answered

how do I allow user to choose a folder to run the rest of the functions?

<https://www.mathworks.com/help/matlab/ref/uigetdir.html uigetdir>

how do I allow user to choose a folder to run the rest of the functions?

<https://www.mathworks.com/help/matlab/ref/uigetdir.html uigetdir>

8 meses ago | 0

Answered

Create array of “deep” struct (scalar) fields

As always, you can use a small utility function to drill down the object hierarchy It's probably not the most elegant solution ...

Create array of “deep” struct (scalar) fields

As always, you can use a small utility function to drill down the object hierarchy It's probably not the most elegant solution ...

8 meses ago | 1

Answered

Plot text (x axis) vs. y axis (numbers)

Why don't you convert x to a number? % mock data hrs = arrayfun(@(n) [num2str(n) 'H'], 0:23, 'UniformOutput', false); hrs(1:1...

Plot text (x axis) vs. y axis (numbers)

Why don't you convert x to a number? % mock data hrs = arrayfun(@(n) [num2str(n) 'H'], 0:23, 'UniformOutput', false); hrs(1:1...

8 meses ago | 0

Answered

Indexing a matrix that's not in the workspace

you can write a utility function to do that function value = debugPrint(a, i) value = a(i); end %% or using an anonymo...

Indexing a matrix that's not in the workspace

you can write a utility function to do that function value = debugPrint(a, i) value = a(i); end %% or using an anonymo...

8 meses ago | 0

| accepted

Answered

How do I unstack/transpose table in Matlab?

unstack groups using a third column, but you can trick it to do what you want by adding a fake third column id={'id1';'id1';'id...

How do I unstack/transpose table in Matlab?

unstack groups using a third column, but you can trick it to do what you want by adding a fake third column id={'id1';'id1';'id...

8 meses ago | 1

| accepted

Answered

GUI gives error after moving to a different computer

Another possible workaround would be to create a stub of this function Unfortunately this function is not a builtin, so builtin...

GUI gives error after moving to a different computer

Another possible workaround would be to create a stub of this function Unfortunately this function is not a builtin, so builtin...

8 meses ago | 1

Answered

How to write elements of a nested cell array to an excel?

The problem starts with the different sizes of each rpw which makes it more complecated to unravel the nested cell arrays c...

How to write elements of a nested cell array to an excel?

The problem starts with the different sizes of each rpw which makes it more complecated to unravel the nested cell arrays c...

8 meses ago | 0

Answered

How to remove numbers that only show up once in a list of recurring numbers

x = [1,1,1,1,2,3,3,3,3,4,5,5,5,5,6,7,7,7,7,7,7,8,53,54,54,54,54,54]; numbers = 1:max(x); numx = accumarray(x(:), 1); atLeast2...

How to remove numbers that only show up once in a list of recurring numbers

x = [1,1,1,1,2,3,3,3,3,4,5,5,5,5,6,7,7,7,7,7,7,8,53,54,54,54,54,54]; numbers = 1:max(x); numx = accumarray(x(:), 1); atLeast2...

9 meses ago | 0