Answered

Time format in netcdf files

"I want to extract time series from a netcdf file but the time format is like this: " Why "but", that's the way date-time is st...

Time format in netcdf files

"I want to extract time series from a netcdf file but the time format is like this: " Why "but", that's the way date-time is st...

15 giorni ago | 0

Answered

Why does exceeding array index in this program not show an error?

Because there are values of the second index, which exceeds 1000 (as you have noticed) K>> (kk+1)*R:-1:kk*R+1 ans = Columns...

Why does exceeding array index in this program not show an error?

Because there are values of the second index, which exceeds 1000 (as you have noticed) K>> (kk+1)*R:-1:kk*R+1 ans = Columns...

17 giorni ago | 1

Answered

Trying to find row number in a large matrix

Your one-liner is missing a closing parentheses and Matlab proposes an improvement rigth-clicking "find" opens a context menu...

Trying to find row number in a large matrix

Your one-liner is missing a closing parentheses and Matlab proposes an improvement rigth-clicking "find" opens a context menu...

18 giorni ago | 0

| accepted

Answered

Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.

I fail to reproduce the error you report. However, that should not surprise since your description of how you execute the classe...

Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array element.

I fail to reproduce the error you report. However, that should not surprise since your description of how you execute the classe...

20 giorni ago | 0

| accepted

Answered

How to write a matrix m.file?

Without syntatic sugar >> data = cat( 2, reshape((42:-7:7),[],1), reshape((3:6:33),[],1) ) data = 42 3 35 9 ...

How to write a matrix m.file?

Without syntatic sugar >> data = cat( 2, reshape((42:-7:7),[],1), reshape((3:6:33),[],1) ) data = 42 3 35 9 ...

22 giorni ago | 0

| accepted

Answered

List of built-in functions?

On R2018b, Win10 and a SSD, this code %% tic sad = dir( fullfile( matlabroot, 'toolbox', 'matlab', '**', '*.m' ) ); %% for ...

List of built-in functions?

On R2018b, Win10 and a SSD, this code %% tic sad = dir( fullfile( matlabroot, 'toolbox', 'matlab', '**', '*.m' ) ); %% for ...

22 giorni ago | 0

| accepted

Answered

Finding last non-zero rows for individual columns of a matrix without loops

Try this [r,c] = find( A==0 ); [~,ixa] = unique( c, 'last' ); >> r(ixa) ans = 3 4

Finding last non-zero rows for individual columns of a matrix without loops

Try this [r,c] = find( A==0 ); [~,ixa] = unique( c, 'last' ); >> r(ixa) ans = 3 4

23 giorni ago | 1

| accepted

Answered

Average data by time

I encountered two problems with the csv-file the first line, which I just deleted the strings, NA, which I replaced by nan ...

Average data by time

I encountered two problems with the csv-file the first line, which I just deleted the strings, NA, which I replaced by nan ...

26 giorni ago | 0

| accepted

Answered

Quick removal of records in structure

Caveat: I don't fully understand your use case. I assume that "record" is what in the documentation is called "element of st...

Quick removal of records in structure

Caveat: I don't fully understand your use case. I assume that "record" is what in the documentation is called "element of st...

26 giorni ago | 0

Answered

How do I detect line number while reading a file?

There is no function that takes the output of ftell() and returns the line number. One has to keep track of the line number wi...

How do I detect line number while reading a file?

There is no function that takes the output of ftell() and returns the line number. One has to keep track of the line number wi...

28 giorni ago | 0

| accepted

Answered

a figure with only a numeric value

Is this close to what you are asking for? lh = plot( 0.5, 0.82, 'd' ); ah = lh.Parent; ah.XTickLabels = cell(1,1); ah.YTickL...

a figure with only a numeric value

Is this close to what you are asking for? lh = plot( 0.5, 0.82, 'd' ); ah = lh.Parent; ah.XTickLabels = cell(1,1); ah.YTickL...

circa un mese ago | 0

| accepted

Answered

Plotting datetime from dataset

You may specify the format of the time axis in the plot command. See the documentation of plot() %% Create some data that resa...

Plotting datetime from dataset

You may specify the format of the time axis in the plot command. See the documentation of plot() %% Create some data that resa...

circa un mese ago | 0

Answered

Rounding date time to nearest half hour wihtin a table

An alternate way %% A slightly modified example from the documentation MeasurementTime = datetime({'2015-12-18 08:03:05';'2015...

Rounding date time to nearest half hour wihtin a table

An alternate way %% A slightly modified example from the documentation MeasurementTime = datetime({'2015-12-18 08:03:05';'2015...

circa un mese ago | 0

| accepted

Answered

How to count the number of times I called a function (using the command line)

You could replace counter=0; %Initializing counter by persistent counter if isempty( counter ) counter=0; %Initializin...

How to count the number of times I called a function (using the command line)

You could replace counter=0; %Initializing counter by persistent counter if isempty( counter ) counter=0; %Initializin...

circa un mese ago | 0

| accepted

Answered

Is it possible to have an array of function handles?

The short answer is no. However, it's possible to store function handles in a cell array. f = cell(2,1); f{1} = y1prime; f{2...

Is it possible to have an array of function handles?

The short answer is no. However, it's possible to store function handles in a cell array. f = cell(2,1); f{1} = y1prime; f{2...

circa un mese ago | 0

| accepted

Answered

This statement is not inside any function. (It follows the END that terminates the definition of the function "extract_tiff".)

There are two end at the end of the function. k=k+1; end end Remove one of them

This statement is not inside any function. (It follows the END that terminates the definition of the function "extract_tiff".)

There are two end at the end of the function. k=k+1; end end Remove one of them

circa un mese ago | 0

Answered

Can I control filter command?

Yes, filter() is possible. Try y = filter( 1, [1,1], x );

Can I control filter command?

Yes, filter() is possible. Try y = filter( 1, [1,1], x );

circa un mese ago | 0

| accepted

Answered

Creating a row vector of noisy data.

A naive code noise = 2.0 * randn(1,100); noise = noise .* (2.0./std(noise)); std( noise ) ans = 2 a bit closer...

Creating a row vector of noisy data.

A naive code noise = 2.0 * randn(1,100); noise = noise .* (2.0./std(noise)); std( noise ) ans = 2 a bit closer...

circa un mese ago | 0

Answered

Extracting column from text file

This is a fixed-width text file. The documentation includes a good description on how to read fixed-width text files. See fi...

Extracting column from text file

This is a fixed-width text file. The documentation includes a good description on how to read fixed-width text files. See fi...

circa un mese ago | 0

| accepted

Answered

Sorting numbers according to elements of an array

Without comment: >> [~,ix]=min(abs(SORTING-input)) ix = 1 >> SORTING(ix) ans = 3 >> >> [~,ix]=min(abs(SORTING...

Sorting numbers according to elements of an array

Without comment: >> [~,ix]=min(abs(SORTING-input)) ix = 1 >> SORTING(ix) ans = 3 >> >> [~,ix]=min(abs(SORTING...

circa un mese ago | 1

Answered

how to debugg the error : size input must be integers

"how to debug" Before trying to fix the problem see: Debug a MATLAB Program Next set Pause on Errors and run Section_...

how to debugg the error : size input must be integers

"how to debug" Before trying to fix the problem see: Debug a MATLAB Program Next set Pause on Errors and run Section_...

circa 2 mesi ago | 0

Answered

Does matlab create pointers to objects or create new copies?

See Comparison of Handle and Value Classes

Does matlab create pointers to objects or create new copies?

See Comparison of Handle and Value Classes

circa 2 mesi ago | 1

| accepted

Answered

Namespace management for packages+sub-packages

Yes, that's the way it is. And sprinkle the code with import doesn't really help. Nevertheless, I find packages useful. A bett...

Namespace management for packages+sub-packages

Yes, that's the way it is. And sprinkle the code with import doesn't really help. Nevertheless, I find packages useful. A bett...

circa 2 mesi ago | 0

Answered

Mean command gives wrong answer

Analyze this %% x=[1,2,3,4,5,6,7,8,9,10,11,12]; % x values y=[15,120,2,30,40,150,60,170,80,9,15,1000]; % y values %% idx1 =...

Mean command gives wrong answer

Analyze this %% x=[1,2,3,4,5,6,7,8,9,10,11,12]; % x values y=[15,120,2,30,40,150,60,170,80,9,15,1000]; % y values %% idx1 =...

circa 2 mesi ago | 1

| accepted

Answered

Are enum-comparisons slow in MATLAB?

Indeed, enumerations make slow code. This is an anecdote about a code based on enumeration that proved useless because of poor...

Are enum-comparisons slow in MATLAB?

Indeed, enumerations make slow code. This is an anecdote about a code based on enumeration that proved useless because of poor...

circa 2 mesi ago | 0

| accepted

Answered

Basic queries Matlab (vectors, indexing, construct matrices in a specific form)

Exercise 1 and 2 "[...] however it confuses me the way the question is written!" Agree; the very same vector has three differe...

Basic queries Matlab (vectors, indexing, construct matrices in a specific form)

Exercise 1 and 2 "[...] however it confuses me the way the question is written!" Agree; the very same vector has three differe...

circa 2 mesi ago | 0

| accepted

Answered

keep element greater than immediate previous element

An alternative %% x = [1 2 3 4 3 2 3 4 6 8 5 5 6 8.5 9 11 12 ]; %% dx = 1; while not( isempty( dx ) ) dx = fin...

keep element greater than immediate previous element

An alternative %% x = [1 2 3 4 3 2 3 4 6 8 5 5 6 8.5 9 11 12 ]; %% dx = 1; while not( isempty( dx ) ) dx = fin...

circa 2 mesi ago | 1

Answered

How to reduce computation time

On R2018b and a new vanilla PC I found a significant decrease in computation time by replacing quad2d() by integral2() (with the...

How to reduce computation time

On R2018b and a new vanilla PC I found a significant decrease in computation time by replacing quad2d() by integral2() (with the...

circa 2 mesi ago | 1

Answered

How can I write a variable which datatype is a string in netcdf file

Most likely, the space you specified for the variable calibration_procedure in the nc-file, i.e. 'Dimensions',{'hydrophone_cou...

How can I write a variable which datatype is a string in netcdf file

Most likely, the space you specified for the variable calibration_procedure in the nc-file, i.e. 'Dimensions',{'hydrophone_cou...

circa 2 mesi ago | 0

| accepted