Answered

Variable in Text [Matlab]

How can I implement variable to the text variable You don't! Numbered variables are always a bad idea. Instead you use indexing...

Variable in Text [Matlab]

How can I implement variable to the text variable You don't! Numbered variables are always a bad idea. Instead you use indexing...

14 hours ago | 0

Answered

Import of tables from R where the first line describing the column names is one element shorter

Yes, readtable expects the variable name line to have a placeholder (DimensionName) for the row name column. I suggest you raise...

Import of tables from R where the first line describing the column names is one element shorter

Yes, readtable expects the variable name line to have a placeholder (DimensionName) for the row name column. I suggest you raise...

16 hours ago | 0

Answered

changing file name in matlab

Something like this should work: folder = 'C:\somewhere\somefolder'; %whichever folder contains the files filelist = dir(fu...

changing file name in matlab

Something like this should work: folder = 'C:\somewhere\somefolder'; %whichever folder contains the files filelist = dir(fu...

17 hours ago | 1

Answered

matrix mis-match

There doesn't appear to be any logic behind the choice of * vs .*, / vs ./, etc. If you don't understand the difference between ...

matrix mis-match

There doesn't appear to be any logic behind the choice of * vs .*, / vs ./, etc. If you don't understand the difference between ...

4 days ago | 1

Answered

multiply two series of vector in loops

Assuming R2016b or later: result = MA .* permute(MB, [3, 2, 1]); will give you a 3D matrix, where result(i, :, j) is MA(i, :) ...

multiply two series of vector in loops

Assuming R2016b or later: result = MA .* permute(MB, [3, 2, 1]); will give you a 3D matrix, where result(i, :, j) is MA(i, :) ...

4 days ago | 0

Answered

How can i move excel sheets in the same file

This should do the job: function reordersheets(excelfile) %excelfile: full path of excel file whose sheet are to be reorde...

How can i move excel sheets in the same file

This should do the job: function reordersheets(excelfile) %excelfile: full path of excel file whose sheet are to be reorde...

5 days ago | 0

| accepted

Answered

Calling function described in actxcontrol inside parfor loop

I'm not entirely sure what you mean by "It doesn't exist inside the script as it is, but this function is a component of actxcon...

Calling function described in actxcontrol inside parfor loop

I'm not entirely sure what you mean by "It doesn't exist inside the script as it is, but this function is a component of actxcon...

6 days ago | 0

Answered

mkdir and simulations problems

As far as I can see the problem has nothing to do with matlab expertise but is a failure in your logic. You create a folder nam...

mkdir and simulations problems

As far as I can see the problem has nothing to do with matlab expertise but is a failure in your logic. You create a folder nam...

6 days ago | 0

Answered

How to extract elements from each dimension of a 3D matrix and put it in a vector.

Sure, you just have to type the same code 91 times... As you can guess, that's not a viable approach. If you start numbering va...

How to extract elements from each dimension of a 3D matrix and put it in a vector.

Sure, you just have to type the same code 91 times... As you can guess, that's not a viable approach. If you start numbering va...

6 days ago | 0

| accepted

Answered

Add a value to an element in a matrix

Cause is a specific problem where I need to add that values of S just in these columns of A Then, this should work: A(S(1, :) ...

Add a value to an element in a matrix

Cause is a specific problem where I need to add that values of S just in these columns of A Then, this should work: A(S(1, :) ...

7 days ago | 0

| accepted

Answered

How to divide timeseries data into seasonal variation

Note that if you're indeed using timeseries, you may be better off using timetables instead. They're slightly easier to use and ...

How to divide timeseries data into seasonal variation

Note that if you're indeed using timeseries, you may be better off using timetables instead. They're slightly easier to use and ...

7 days ago | 0

Answered

FileCopy does't work

I don't remember the details of your previous question, but clearly the code I gave you is meant to work with data imported a pa...

FileCopy does't work

I don't remember the details of your previous question, but clearly the code I gave you is meant to work with data imported a pa...

7 days ago | 0

Answered

"Reference to non-existent field" Error

Well, yes, you never use the input parser to parse your input, so the Results never get populated. p.parse(system); after you'...

"Reference to non-existent field" Error

Well, yes, you never use the input parser to parse your input, so the Results never get populated. p.parse(system); after you'...

8 days ago | 0

| accepted

Answered

load C/C++ DLL on a computer without internet access

Most likely, the library is C not C++. They're two very different things and loadlibrary cannot load C++ dlls. You can generate...

load C/C++ DLL on a computer without internet access

Most likely, the library is C not C++. They're two very different things and loadlibrary cannot load C++ dlls. You can generate...

8 days ago | 0

Answered

Some number inputs do not work with code while others do.

You can see in your screenshot that both mass and acceleration are text not number. While you can indeed multiply two strings to...

Some number inputs do not work with code while others do.

You can see in your screenshot that both mass and acceleration are text not number. While you can indeed multiply two strings to...

8 days ago | 0

| accepted

Answered

Problem with for loop within a loop of a loop

Probably, the biggest source of slow down is the lack of preallocation of u. As a result, it grows one column at a time, necessa...

Problem with for loop within a loop of a loop

Probably, the biggest source of slow down is the lack of preallocation of u. As a result, it grows one column at a time, necessa...

8 days ago | 1

| accepted

Answered

Using an array of indexes to index an array

Note that if you didnt' preallocate finalImage before the loop, your code will be slow indeed since finalImage would be realloca...

Using an array of indexes to index an array

Note that if you didnt' preallocate finalImage before the loop, your code will be slow indeed since finalImage would be realloca...

8 days ago | 0

| accepted

Answered

Raising a matrix to a power

The problem is not the .^0.5, it's the ^2, which probably should be .^2. Note that x.^0.5 is the same as sqrt(x). However, If T...

Raising a matrix to a power

The problem is not the .^0.5, it's the ^2, which probably should be .^2. Note that x.^0.5 is the same as sqrt(x). However, If T...

8 days ago | 0

Answered

Conversion to double from cell is not possibel

Whatever T is, it's very likely that: T(j, 2:10) = a_table is going to be an error. Now, I wouldn't expect that line to thro...

Conversion to double from cell is not possibel

Whatever T is, it's very likely that: T(j, 2:10) = a_table is going to be an error. Now, I wouldn't expect that line to thro...

9 days ago | 0

Answered

How to estimate the summation equation quickly in Matlab?

If I've understood your formula correctly: returns = readtable('PC Example.xlsx'); %read the data [year, month] = ymd(return...

How to estimate the summation equation quickly in Matlab?

If I've understood your formula correctly: returns = readtable('PC Example.xlsx'); %read the data [year, month] = ymd(return...

9 days ago | 0

| accepted

Answered

How to view Figure source code?

There is no source code for a figure that you can view (the figure creation code was probably originally written in C, C++, Java...

How to view Figure source code?

There is no source code for a figure that you can view (the figure creation code was probably originally written in C, C++, Java...

9 days ago | 0

Answered

Undefined function 'diff' for input arguments of type 'table'

As I've told you already, read the documentation, in particular Access data in tables. As explained on that page, () indexing ...

Undefined function 'diff' for input arguments of type 'table'

As I've told you already, read the documentation, in particular Access data in tables. As explained on that page, () indexing ...

9 days ago | 1

| accepted

Answered

How to resolve this error Error using fprintf Function is not defined for 'cell' inputs.

This is how I'd do it: hstr = cellfun(@(v) strjoin(compose("%d", v), " "), h); %convert each vector in h into a string [row, ...

How to resolve this error Error using fprintf Function is not defined for 'cell' inputs.

This is how I'd do it: hstr = cellfun(@(v) strjoin(compose("%d", v), " "), h); %convert each vector in h into a string [row, ...

9 days ago | 0

Answered

Programatically creating an anonymous function that separates "Variables" and "Parameters"

Thinking a bit more about it, metaprogramming in matlab can often only be achieved by using the dreaded eval. This is a rare cas...

Programatically creating an anonymous function that separates "Variables" and "Parameters"

Thinking a bit more about it, metaprogramming in matlab can often only be achieved by using the dreaded eval. This is a rare cas...

10 days ago | 2

Answered

Programatically creating an anonymous function that separates "Variables" and "Parameters"

You won't be able to do this with just anonymous functions, they're too limited in matlab (no multiple statements, no branching)...

Programatically creating an anonymous function that separates "Variables" and "Parameters"

You won't be able to do this with just anonymous functions, they're too limited in matlab (no multiple statements, no branching)...

10 days ago | 0

| accepted

Answered

What do the empty square brackets [] do in the expression executed by eval?

The same as they always do, concatenate whatever is inside the bracket. model must contain a char vector, so it just appends (0,...

What do the empty square brackets [] do in the expression executed by eval?

The same as they always do, concatenate whatever is inside the bracket. model must contain a char vector, so it just appends (0,...

10 days ago | 0

Answered

MATLAB doesn't let me plot 3 graphs in the same plot

Matlab plots exactly what you ask it. plot(tm,ve(i+1),'green') will plot the scalar value ve(21) (since after the loop i is 20...

MATLAB doesn't let me plot 3 graphs in the same plot

Matlab plots exactly what you ask it. plot(tm,ve(i+1),'green') will plot the scalar value ve(21) (since after the loop i is 20...

10 days ago | 2

Answered

matrix dimension reshape error

i had expected to have dimension error in line 6 but it did not I would expect an error if the if condition is true when n <= 2...

matrix dimension reshape error

i had expected to have dimension error in line 6 but it did not I would expect an error if the if condition is true when n <= 2...

11 days ago | 0

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

11 days ago

Answered

Best way to create a matrix of points?

A=[-5 -4.5 1.5 2; -5 -4.5 2 2.5; -5 -4.5 2.5 3; -4.5 -4 1.5 2; -4.5 -4 2 2.5; -4.5 -4 2.5 3]; points = unique([A(:, [1, 3]); ...

Best way to create a matrix of points?

A=[-5 -4.5 1.5 2; -5 -4.5 2 2.5; -5 -4.5 2.5 3; -4.5 -4 1.5 2; -4.5 -4 2 2.5; -4.5 -4 2.5 3]; points = unique([A(:, [1, 3]); ...

11 days ago | 0

| accepted