已回答

Class property automatically propagated to old class instances

See Comparison of Handle and Value Classes Your exampleClass is a value class. However, the behavior you describe is more like ...

Class property automatically propagated to old class instances

See Comparison of Handle and Value Classes Your exampleClass is a value class. However, the behavior you describe is more like ...

3 years 前 | 0

| 已接受

已回答

Index in position 1 exceeds array bounds. Index must not exceed 1.

What is your intention with this assignment? %% Initial condition T(:,:) = 293; % initial temperature (K) Matlab mak...

Index in position 1 exceeds array bounds. Index must not exceed 1.

What is your intention with this assignment? %% Initial condition T(:,:) = 293; % initial temperature (K) Matlab mak...

3 years 前 | 0

已回答

Run a large number of iterations without the use of a for loop

Preallocating the variable t will improve speed a lot. Something like t = nan( 1536256, 1 ); t(1) = rf-r0; ... t(i) = rf-...

Run a large number of iterations without the use of a for loop

Preallocating the variable t will improve speed a lot. Something like t = nan( 1536256, 1 ); t(1) = rf-r0; ... t(i) = rf-...

3 years 前 | 1

已回答

How to vectorize the function?

Read Array vs. Matrix Operations. With scalars the two produce the same result, but not with vectors and arrays. The second se...

How to vectorize the function?

Read Array vs. Matrix Operations. With scalars the two produce the same result, but not with vectors and arrays. The second se...

3 years 前 | 1

| 已接受

已回答

How am I suppose to fix this error. I am trying to run the code in order to get a stress vs strain plot and find the value described in the script.

This script runs without throwing errors; the syntax is correct. I assigned values to some undefined variables, lo, m, x, y. C...

How am I suppose to fix this error. I am trying to run the code in order to get a stress vs strain plot and find the value described in the script.

This script runs without throwing errors; the syntax is correct. I assigned values to some undefined variables, lo, m, x, y. C...

3 years 前 | 0

| 已接受

已回答

Extracting the numeric part from a cell

Try >> extractBetween( "injection-0:94582)", ":", ")" ) ans = "94582"

Extracting the numeric part from a cell

Try >> extractBetween( "injection-0:94582)", ":", ")" ) ans = "94582"

3 years 前 | 1

已回答

'line' returns number instead of handle inside a loop of a class method

I have reproduced your findings on R2018b. The numerical "handles" are the old type, pre R2014b. I failed to find an explanati...

'line' returns number instead of handle inside a loop of a class method

I have reproduced your findings on R2018b. The numerical "handles" are the old type, pre R2014b. I failed to find an explanati...

3 years 前 | 0

已回答

Error using for loop to delete empty cell array elements

Replace for i=1:numel(temp_routes_log) by for i = numel(temp_routes_log) : -1 : 1 % loop from last to first element OR if r...

Error using for loop to delete empty cell array elements

Replace for i=1:numel(temp_routes_log) by for i = numel(temp_routes_log) : -1 : 1 % loop from last to first element OR if r...

3 years 前 | 0

| 已接受

已回答

how to find the immediate date before in one column based on another column using find function?

Assumptions: the two column vectors are sorted a specific date in the first vector may exist in the second vector more than o...

how to find the immediate date before in one column based on another column using find function?

Assumptions: the two column vectors are sorted a specific date in the first vector may exist in the second vector more than o...

3 years 前 | 0

| 已接受

已回答

Whitespace Delimited Textfile, NaN results?

The problem is caused by 'Delimiter',' ' in datacell = textscan(fid,'%f%f%f%f', 'Delimiter',' ', 'CollectOutput', 1); in co...

Whitespace Delimited Textfile, NaN results?

The problem is caused by 'Delimiter',' ' in datacell = textscan(fid,'%f%f%f%f', 'Delimiter',' ', 'CollectOutput', 1); in co...

3 years 前 | 1

| 已接受

已回答

empty array size is stuck on 1x3

Try replace fscanf(fileID,'\n\n\n\n\n\n\n\n\n\n\n\n\n\n'); by for jj = 1 : 14 fgetl( fileID ); end fscanf(fileID,'\n\n...

empty array size is stuck on 1x3

Try replace fscanf(fileID,'\n\n\n\n\n\n\n\n\n\n\n\n\n\n'); by for jj = 1 : 14 fgetl( fileID ); end fscanf(fileID,'\n\n...

3 years 前 | 0

已回答

Please help me to look at the code. Thx

This returns a numerical result, but it's not an integer. fun = @(x) exp(-x.^2./2); int = gausslegendre( 0, 2, fun, 1 ) func...

Please help me to look at the code. Thx

This returns a numerical result, but it's not an integer. fun = @(x) exp(-x.^2./2); int = gausslegendre( 0, 2, fun, 1 ) func...

3 years 前 | 0

| 已接受

已回答

I have an invalid use of operator error

I have modified your function to avoid the recursive call of the function. atmos function [T,p,rho] = atmos() h = 0:0.2:20...

I have an invalid use of operator error

I have modified your function to avoid the recursive call of the function. atmos function [T,p,rho] = atmos() h = 0:0.2:20...

3 years 前 | 1

| 已接受

已回答

Trouble using the system command with special characters

You try to call system() with a sequence of several input arguments and assumes that system() shall join these arguments to the ...

Trouble using the system command with special characters

You try to call system() with a sequence of several input arguments and assumes that system() shall join these arguments to the ...

3 years 前 | 0

已回答

Cell Mode and how to use it in Debugging.

There is a bit of confusing nomenclature regarding this feature. Futhermore the feature has evolved over the years. I found this...

Cell Mode and how to use it in Debugging.

There is a bit of confusing nomenclature regarding this feature. Futhermore the feature has evolved over the years. I found this...

3 years 前 | 0

提问

How to find package functions that are shadowed?

I'm missing something. It is possible to have several package functions with identical fully qualified names, e.g. p1.test, on ...

3 years 前 | 1 个回答 | 2

已回答

Create matrix using the array as index

Try this M = zeros(5,5); a = [2,2,1,0,3]; for jj = 1:5 M(a(jj)+1,jj)=1; end disp(M)

Create matrix using the array as index

Try this M = zeros(5,5); a = [2,2,1,0,3]; for jj = 1:5 M(a(jj)+1,jj)=1; end disp(M)

3 years 前 | 1

已回答

Import large csv as datastore with formatting errors

Comment out the offending rows open files while not( feof(fid) ) chr = fgetl(fid); is_ok = analyse_row( chr ); ...

Import large csv as datastore with formatting errors

Comment out the offending rows open files while not( feof(fid) ) chr = fgetl(fid); is_ok = analyse_row( chr ); ...

3 years 前 | 1

| 已接受

已回答

I am getting "Undefined function or variable" for an existing variable.

Run this modified script from the command window whos par* run QuickSIN_parameters.m % load experiment parameters whos par* ...

I am getting "Undefined function or variable" for an existing variable.

Run this modified script from the command window whos par* run QuickSIN_parameters.m % load experiment parameters whos par* ...

3 years 前 | 0

提问

R2021b: The Run Section tool in the Editor has been removed

I use the Run Section tool all the time and was surprised to read in the R2021b release notes that it's been removed. Is it repl...

3 years 前 | 3 个回答 | 0

已回答

how to delete repeated rows in a table?

Test this %% M = [518460 3.322; 518460 -12.984; 518520 3.798; 518520 -10.28; 518580 7.763; 518580 16.851; 518640 5.959; 522225...

how to delete repeated rows in a table?

Test this %% M = [518460 3.322; 518460 -12.984; 518520 3.798; 518520 -10.28; 518580 7.763; 518580 16.851; 518640 5.959; 522225...

3 years 前 | 1

| 已接受

已回答

how to find a float number

find( abs( y7 -(-0.3340) ) < tol ) You choose tol. See eps - Floating-point relative accuracy

how to find a float number

find( abs( y7 -(-0.3340) ) < tol ) You choose tol. See eps - Floating-point relative accuracy

3 years 前 | 0

| 已接受

已回答

Tiny discussion on good practices in object oriented programming (OOP) through a simple example

"[...]titles of decent books for non-programmers" AFAIK: There is no book on object oriented design and programming with Matlab...

Tiny discussion on good practices in object oriented programming (OOP) through a simple example

"[...]titles of decent books for non-programmers" AFAIK: There is no book on object oriented design and programming with Matlab...

3 years 前 | 0

提问

Is the Abstract keyword needed to make a method abstract?

Is this correct Matlab syntax classdef MyClass methods outarg = my_method( this, inarg ); end end R2018b a...

3 years 前 | 1 个回答 | 0

已回答

How to speed up the while loop?

You didn't test the code before uploading! I modified the input lines z = 1; % input('Enter zeta, z = '); w = 1; % input('Ent...

How to speed up the while loop?

You didn't test the code before uploading! I modified the input lines z = 1; % input('Enter zeta, z = '); w = 1; % input('Ent...

3 years 前 | 0

| 已接受

已回答

I got stuck with a loop after the value gets to NaN

The values of xr and yr do not converge to a solution that you expect. xr goes to zero and yr goes to "infinity". >> Newton_Ra...

I got stuck with a loop after the value gets to NaN

The values of xr and yr do not converge to a solution that you expect. xr goes to zero and yr goes to "infinity". >> Newton_Ra...

3 years 前 | 1

| 已接受

已回答

Why the ouput of disp input function become looping?

The expected output is repeated a zillion times, because yfit is a vector with a zillion elements >> whos yfit Name Si...

Why the ouput of disp input function become looping?

The expected output is repeated a zillion times, because yfit is a vector with a zillion elements >> whos yfit Name Si...

3 years 前 | 0

| 已接受

已回答

Split every matrix in cell and make it into different cell

One way %% M = ones(32,32,2,3); % Sample data (20000 replaced by 3) C = mat2cell( M, 32, 32, 2, ones(1,3) ); %% C = sque...

Split every matrix in cell and make it into different cell

One way %% M = ones(32,32,2,3); % Sample data (20000 replaced by 3) C = mat2cell( M, 32, 32, 2, ones(1,3) ); %% C = sque...

3 years 前 | 0

| 已接受

已回答

How to convert 32x32x2x20000 into 20000x1 cell array?

A mat2cell example %% M = ones(32,32,2,6); % Sample data (20000 replaced by 6) C = mat2cell( M, 32, 32, 2, ones(1,6) ); %...

How to convert 32x32x2x20000 into 20000x1 cell array?

A mat2cell example %% M = ones(32,32,2,6); % Sample data (20000 replaced by 6) C = mat2cell( M, 32, 32, 2, ones(1,6) ); %...

3 years 前 | 0

| 已接受