Community Profile # Rik

Last seen: Today 2017 以来アクティブ

E-mails with feedback/questions about FEX submissions are welcomed. In general I will post e-mails about Answers on the related page, unless there is good cause not to do so.

#### Statistics

All
• • • • • • • • • • • • バッジを表示

#### Content Feed

Matlab Basics - Rounding III
Write a script to round a large number to the nearest 10,000 e.g. x = 12,358,466,243 --> y = 12,358,470,000

Matlab Basics - Rounding II
Write a script to round a variable x to 3 decimal places: e.g. x = 2.3456 --> y = 2.346

Check that number is whole number
Check that number is whole number Say x=15, then answer is 1. x=15.2 , then answer is 0. http://en.wikipedia.org/wiki/Whole_numb...

MATLAB Basic: rounding IV
Do rounding towards plus infinity. Example: -8.8, answer -8 +8.1 answer 9 +8.50 answer 9

MATLAB Basic: rounding III
Do rounding towards minus infinity. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 8

MATLAB Basic: rounding II
Do rounding nearest integer. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 9

MATLAB Basic: rounding
Do rounding near to zero Example: -8.8, answer -8 +8.1 answer 8

Find the nearest two values in all grid cells to a specified value across a 3D matrix
Why squeeze the indices? Just use them to index (for which you need sub2ind). As for the second closest: the easiest way is to ...

4日 前 | 0

| 採用済み

Calling the error function does not print the line number in r2022b
I personally use my own customized versions of error and warning. They take an options struct as the first argument to determine...

5日 前 | 0

Pseudorandom character matrix generation
If you want a 10x10 char array, you can also use indexing: source = 'bdpq'; Array = source(randi(end,[10 10]))

5日 前 | 0

| 採用済み

If not with a xlsx file
You should have used isempty in your current code: if ~isempty(app.filename) For the test you now want to do, you should extra...

6日 前 | 0

| 採用済み

Saving file causes glitch
As a temporary workaround you can use this: edit my_script.m % should give you a popup asking if you want to create the file O...

6日 前 | 0

Fitting data from file
You can specify those parameters, but what is much more effective is providing good initial guesses (and not mixing up x and y):...

6日 前 | 1

| 採用済み

get alpha (color) value of a line
I have no clue why this is hidden, but converting the object to a struct and hunting for a few appropriate candidates I found th...

6日 前 | 1

| 採用済み

Appending mixed types to strings seems a bit tricky. Is this the intended behaviour?
It helps to do this step by step, which show that (while unintuitive), this is intended behavior. Matlab evaluates code from le...

6日 前 | 3

| 採用済み

How to assign matrices to an array in a for loop
You can use a cell array: for i = 1:5 matrices{i} = [i*1 i*2 i*3; i*4 i*5 i*6; i*7 i*8 i*9]; end

7日 前 | 1

| 採用済み

APP Designer code convert to CPP code
Do you need to generate the C++ code, or is it also fine to end up a stand-alone executable? As the message indicates, UIFigure...

12日 前 | 0

Difference between "||" and "&&" in my loop
The or operator means and/or, just like it does in mathematics. You can use the xor function (although no operator or short-circ...

12日 前 | 0

How to reduce the file size of a saved histogram figure
You have two options that I'm aware of: # Change the underlying data so you reproduce the same bins with fewer data points. ...

13日 前 | 1

Computational cost of the commanda 'path'
Once you are at the stage where the profiler makes any sense at all, you should question why you are still using scripts instead...

13日 前 | 0

| 採用済み

Change exp from number to e
Your own suggestion actually works (although it requires a call to simplify): syms c1 c2 y(x) f(x) e y(x) = (e^2/(e^2+1))*e^(-...

15日 前 | 0

| 採用済み

confusion matrix with string greek letters like alpha and beta
If you use the actual greek letters, that should work (as long as the function supports all implemented characters): text(1,1,c...

17日 前 | 0

ifversion
Determine if the current version satisfies a version restriction

17日 前 | ダウンロード 2 件 |

reading files that contain changing parts and parts that need to be ignored
You need to use dir to find the actual file name matching some pattern. Then you can provide the function with the real file nam...

18日 前 | 0

| 採用済み

negative positive sign matrix B need to follow matrix A
The sign function seems an obvious choice: A=[ -1 3 -2 4 6]; B=[2.1 2.2 4.2 4.5 5.8]; C=sign(A).*B sum(C)

18日 前 | 2

| 採用済み

How to generate repeatable random multiple vectors with Specific Number of Values and Fixed Sum?
You should try to restructure your problem to make it fit the tools you already have. If we figure out a way to generate an ord...

19日 前 | 0

| 採用済み

Rotate an image around centroid without deformation
I'm not a fan of using i as a variable name, nor do I like shadowing the image primitive with a variable. Other than that, read...

19日 前 | 1

| 採用済み

How to format wkt (well known text string) as a normal string to build a webread input?
I suspect you need to apply percent encoding, as URLs are not allowed to contain spaces.

20日 前 | 0

How to generate random Patient ID numbers?
The save function has two modes: saving variables and saving a struct. The easiest way to solve this error is to store the da...

20日 前 | 1

| 採用済み

how to minus a sequence value
The diff function will do what you want. You can use abs to get the absolute value.

21日 前 | 0

| 採用済み