Community Profile

# Jan

##### Last seen: Today
12 610 total contributions since 2009

It is easier to solve a problem than to guess, what the problem is.

Questions about FileExchange submissions are welcome - get my address from the code. I do not answer mails concerning questions in the forum.

View details...

Contributions in
View by

I have two 3d points, A(1,0,0) and B(0,1,0). And I connect these two points as a line AB. How to divide this line into 10 equally segments and get their coordinates?
A = [1, 0, 0]; B = [0, 1, 0]; ab = B - A; v = linspace(0, 1, 10).'; C = A + v .* ab

ungefär 21 timmar ago | 0

how do i substract the first value from the last one on an array taking out zero values?
Get the corresponding indices: first = find(X, 1, 'first'); last = find(X, 1, 'last'); Result = X(last) - X(first)

2 dagar ago | 0

| accepted

how to solve this error: Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays
What is the size of u10 ? u10 = double(ncread(nc_windfile, 'u10')) ; size(u10) If it has more than 2 dimensions, u10' is not ...

3 dagar ago | 0

| accepted

How to calculate each result of f(x) in the nested for loop?
This is correct, but not useful: j = sqrt(-1); i and j are defined as imaginary units as default already. But you see the ambi...

4 dagar ago | 0

input and output functions
Name your function fibseq. So call it fibseq.m, not "Fibseq.m". The case matters in Matlab. It will have one input n and one ou...

5 dagar ago | 1

| accepted

How to get a function from user without knowing its symbols
See how e.g. fzero and ode45 solves this problem. Here the function has 1 oder 2 variables which must be provided in a specific ...

5 dagar ago | 0

hObject is not created when running GUIDE *.m file - what can be done?
The m-files created by GUIDE are not compatible with other Matlab versions You can expect such troubles.

5 dagar ago | 0

| accepted

Break loop with button click GUI [if button is pressed] [Both plot and button are in different functions]
function main FigH = figure; ButtonH = uicontrol(FigH, 'Style', 'PushButton', 'String', 'Stop', 'Call...

5 dagar ago | 1

| accepted

Why Index exceeds the number of array elements (1) if I change the input order in the anonymous function?
ode45 calls the function to be integrated as f(t, Y) . So the time must be the first input.

5 dagar ago | 1

| accepted

Extract rows from 2 different matrices with different dimensions using If statement
if AR(:,5)==n; This is a vector in the condition. Therefore Matlab inserts an all() implicitly, because conditions of if statem...

5 dagar ago | 1

| accepted

inputdlg does not work Matlab 2020a
User the debugger to find out more details. Type in in the command window: dbstop if caught error Now run the code again and c...

5 dagar ago | 1

if statement/numel (A)
These condition does not do, what you expect: 1<=(i + a)<=numel(A) 1<=(i - a)<=numel(A) They are evaluated from left to right...

5 dagar ago | 0

How to find euclidean distances between cell entries of two RGB matrices?
A = rand(47, 47, 3); B = rand(1, 456 3); AB = reshape(A, 47*47, 1, 3) - B; Dist = vecnom(AB, 2, 3); And now you want to fi...

13 dagar ago | 0

How do I use characters with an if statement?
Prompt = 'Please press any key to roll the dice, press Q or q to quit program: '; str = input(Prompt, 's'); if strncmpi(str...

26 dagar ago | 0

Random draw without re-delivery in a loop
What are your input data? A list of files stored in a folder? (As usual: please explain this instead of letting the readers gues...

ungefär en månad ago | 0

| accepted

search in large cell file
In the loop all lines are stored in the cell an the loops stops, if the last one was not a CHAR. This means, that the last eleme...

ungefär en månad ago | 1

| accepted

Question

MEX api and interleaved complex arrays
Does MATLAB store complex data in interleaved format since R2018a? If you compile a MEX function with the -R2018a flag, you can...

### 1

Reversible matrix in matlab
You want to identify a "regular matrix and non-singular matrix". Then testing only, if it is square and not a zero matrix ist no...

ungefär en månad ago | 0

Calculation precision changed in 2020b?
The ACOS function is numerically instable at 0 and pi. SUM is instable at all. A trivial example: sum([1, 1e17, -1]) .There are...

ungefär en månad ago | 1

Why stock DOT function is suboptimally implemented
Just a comment: Under Matlab 2018b, Core i5-3320M CPU @ 2.60GHz: Elapsed time is 0.249669 seconds. dot(z,z) Elapsed time is ...

ungefär en månad ago | 0

How to concatenate matrices to calculate mean
As Steven has mentioned already, this is the main problem: "I have 40 matrices DJF1979_1980_125 to DJF2019_2020_125" Do not us...

ungefär en månad ago | 0

Submitted

ScaleTime
Fast linear interpolation of equally spaced data (C-MEX and M)

How to read data from a file into cell array keeping indents undisturbed
% Import file: Str = fileread('file.ext'); % Remove trailing line break to avoid appending an additional empty line: if ~is...

| accepted

Not enough input arguments error
What about replacing: for j= 1:N if x(j)<beta1 & x(j)>beta2 f(1,j)=f02(x(j)); end if x(j)>beta1 & x(j)<...

command window no output
Check if you have shadowed the display function: w = cellstring(which('display', '-all')); fprintf('%s\n', w{:}) What do you ...

Find string in the special file
S = fileread('R2_AS - Copy.txt'); i1 = [strfind(S, 'Szenario'), Inf]; i2 = strfind(S, 'has been created.'); width = numel(...

Namelengthmax value in different operating systems
The value of namelengthmax depends on the Matlab version only. It is the same for all operating systems. Identifiers can have ...

Syntax Error using Fcn Block
You need round parentheses for indexing, not square brackets: (1/Mus)*(Ks*(u[3]-u[4])+Ct*(u([7]-u[2])+Kt*(u[6]-u[4])-u[5]) % =...

| accepted

how to compute the number of image from subfolder ?
fullfile(('.\databasee\')) is exactly the same as its input: '.\databasee\'. The unnecessary parentheses are confusing only. To...