Beantwortet
Why is my function not working?
The function must be at the end of the m-file. It's a local file in a script. (Or you can have the script and the function in tw...

mehr als 2 Jahre vor | 0

Beantwortet
I cannot access the comment pane of the MathWorks Blogs. Am I the only one?
Tech support has reproduced the issue and suggests two work arounds Incognito mode in Chrome Clearing cache or cookies "Remo...

mehr als 2 Jahre vor | 0

Gelöst


Finding sum of even numbers in a vector.
Find the sum of all the even numbers present in the input vector x. Examples: Input x = [1 2 3 4] Output y is 6 Input...

mehr als 2 Jahre vor

Beantwortet
Do I use the "for loop" correct or efficiently?
Replace the loops by a(1:1800)=50; a(1801:3000)=90; a(3001:3500)=0; to match the figure

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Specify nature/type of property
... or something like: classdef meals properties food (1,1) struct = struct( 'type',{'wheat'}, 'calories',{...

mehr als 2 Jahre vor | 0

Beantwortet
How to understand a datenum date?
A serial date (number) represents time as the number of days (and fraction of days) from January 0, 0000. sdn = now % the fu...

mehr als 2 Jahre vor | 0

Frage


I cannot access the comment pane of the MathWorks Blogs. Am I the only one?
Over the last week I've failed to access the comment pane of the MathWorks Blogs, but for a few short occasions. Does anybody el...

mehr als 2 Jahre vor | 1 Antwort | 0

1

Antwort

Beantwortet
Strings to variable names
First a little exercise %% results = readtable('raw_data.csv'); results(4,:) %% results.Properties.VariableNames{'Sigma'} =...

mehr als 2 Jahre vor | 1

Beantwortet
How to call a class-specified overloaded version of a function without using an object instance as an argument
"I don't want to define 'sin' as a static method because then sin(myNum) will not automatically invoke the overloaded function" ...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
Recursively reversing large vector efficiently
Five ways to flip a row vector. The last one, reversal_v3(), answers your question. Recursion is by two order of magnitude slowe...

mehr als 2 Jahre vor | 0

Beantwortet
Accessing properties in a class
There is nothing special with the name obj, it's just a name. The assignments in the method, fun1, creates a structure (named o...

mehr als 2 Jahre vor | 0

Beantwortet
Gang-of-Four Design Patterns in MATLAB
I'm not aware of any "full or partial MATLAB collection" and I've search for it more than once. Googling for "design patterns ...

mehr als 2 Jahre vor | 1

Beantwortet
How to relocate (left side) the legend in plot ?
Read the documentation on legend() and notice legend(___,'Location',lcn)

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Creating charts in Matlab
Yes, see the function, bar( ..., 'stacked' ). However, it lacks the 3D character of the bars.

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
[DISCONTINUED] MATLAB Answers Wish-list #5 (and bug reports)
Background: I recently put some effort into answering How to store and reuse coefficients in a for loop. My answer together wi...

mehr als 2 Jahre vor | 1

Beantwortet
How to store and reuse coefficients in a for loop
Caveat: I don't fully understand your code and what I say might not be relevant to your real project. "% Can this double for lo...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
check ismember for each element individually
The function arrayfun() does the trick (i.e. hides the foor-loop) a=[ 1 2 3 3 5 6 6]; b=[1 2 3 5 6]; cac = arrayfun( @(ii) fi...

mehr als 2 Jahre vor | 0

Beantwortet
Is it possible to put multiple functions in one matlab file file?
"I currently have six seperate scripts [you mean functions?]" What differs between the six functions? The name of the nc-files ...

mehr als 2 Jahre vor | 0

Beantwortet
When constructing an instance of class, the constructor must preserve the class of the returned object.
I don't know C++. (For some reason you added the tag "C++".) I guess you are biased by some other language. You need to look cl...

fast 3 Jahre vor | 0

Beantwortet
How do I make this a function?
Something like this. With Matlab it's common practise to use double for all numerical variables. (Matlab has "integer in floatin...

fast 3 Jahre vor | 0

| akzeptiert

Beantwortet
Create table from structure - alignment
I've modified the format specifier. %% mom.a = 1; mom.b = 2; mom.veryLongName = 3; header = {'Moment'; 'Value'}; fnames = ...

fast 3 Jahre vor | 0

Beantwortet
How to replace a number in a row vector with NaN in certain condition
abs(x(6)-x(8)) is equal to 10. Accourding to x_new, x(8) should be replaced by NaN. Thus I have use ">=". %% vec = [15 13 9 ...

fast 3 Jahre vor | 1

| akzeptiert

Beantwortet
Getting Windows to open a file type using a MATLAB application
An alternative that doesn't require the Matlab compiler (but requires a Matlab license to run): Create a bat-file, e.g. read_xl...

fast 3 Jahre vor | 0

Beantwortet
How can I read a '.dat' file on MATLAB?
google says: "A file with the . dat file extension is a generic data file that stores specific information relating to the progr...

fast 3 Jahre vor | 0

Beantwortet
How to quickly find the indecies of elements in an array?
A = [1 9 2 8 3 7 4 6 5]; B = [5 6 7]; [~,ix] = ismember( B, A )

fast 3 Jahre vor | 0

| akzeptiert

Beantwortet
creating a character array in which each element takes multiple characters put together
The RHS of the two assignments in the for-loop are they correct? Don't show data as images. Seven lines can be included as cod...

fast 3 Jahre vor | 2

Beantwortet
Why is command window printing out all the code?
There is a function called echo(), which I've never used. Have you run echo on by mistake? I reproduced the behavior you see ...

fast 3 Jahre vor | 0

Beantwortet
Extracting data using regular expression
"all the columns [...] named "Physics", "Time", "dt", "Progress", "Nonlinear Iteration" "Linear Iterations"...."Nodes After Adap...

fast 3 Jahre vor | 1

| akzeptiert

Beantwortet
Load .dat files from subfolders with different names
Yes to both questions. With help of the code snippets below I guess you can put together a script. sad = dir( fullfile('Folder...

fast 3 Jahre vor | 0

Beantwortet
Index exceeds the number of array elements (1).
Here are some links on debugging in Matlab Debug a MATLAB Program Debugging in MATLAB Debugging session Debugging Approaches...

fast 3 Jahre vor | 0

Mehr laden