Réponse apportée
How do I print coordinates in an (x, y, z) form?
r = pi; lambda = sqrt(2); phi = exp(1); fprintf('Our rectangular coordinates converted to cylindrical coordinates are (%0.2f,...

plus de 2 ans il y a | 0

Réponse apportée
Replacing a field in an structure that is subset within a larger structure
If EVENT is non-scalar them you will get that error. The correct approach is to use a comma-separated list. Lets try it right n...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How to convert /map uint16 to int16 maintaining the dynamic range so that [0] and [2^16-1] in uint16 beomes [-2^15] and [2^15-1] without going through double
inp = uint16([-Inf,pi,Inf]) Method one: use INT32 for the intermediate values: off = int32(intmin('int16')); out = int16(int3...

plus de 2 ans il y a | 3

| A accepté

Réponse apportée
get interpolated values from timetable
INTERP1 accepts DATETIME objects: dt = datetime(1990,1,1,[9;10],0,0); A = [36;28]; B = [12;24]; T = table(dt,A,B) newT = ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Better way to combine number with fraction?
Note that you will need to use SPRINTF (or COMPOSE etc) to get the right output when NANOSEC has fewer than the full nine digits...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Use info in the row based on it being the max value
The second output from MAX is the index, you can use that: [maxDiameter,idx] = max(diameter); row = mat(idx,:)

plus de 2 ans il y a | 0

Réponse apportée
Files read with "dir" have additional (nondesirable) characters
S = dir('C:\Users\XXX\Desktop\...\*.csv'); S(startsWith({S.name},'.')) = [];

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Filtering the common rows between two matrices
A = [1,2,3; 4,5,6; 7,8,9] B = [1,2,3,90; 3,1,2,88; 4,5,6,17; 6,5,4,19; 7,8,9,12; 15,18,22,20] [X,Y] = ismember(sort(B(:,1:3),2...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Handling Undesirable Characters in Numeric Columns When Reading a CSV File
You should NOT make changes to the original data file. fnm = 'p1.csv'; opt = detectImportOptions(fnm, 'FileType','delimitedtex...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
how to open a file from the previous folder
Note that there is absolutely no need to call PWD. Simply use '.' to refer to the current directory: relativePathToC = './../C'...

plus de 2 ans il y a | 0

Réponse apportée
Turning string into a variable name for a function to use
The basic problem is that you are LOADing directly into the workspace. You have already painted yourself into a corner. However,...

plus de 2 ans il y a | 0

Réponse apportée
Remove duplicate lines in a document
txt = fileread('filteredSatellites.txt') rgx = '([^\n\r]+)\s+(1(\s+\S+){8})\s+(2(\s+\S+){8})'; tkn = regexp(txt,rgx,'tokens');...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Error: Unsupported use of the '=' operator. To compare values for equality, use '=='. To specify name-value arguments, check that name is a valid identifier with no surroundin
Get rid of the ellipses inside the square brackets of both macroLats and macroLongitudes: macroLats = [lots of numbers, -...

plus de 2 ans il y a | 0

Réponse apportée
Is it possible to identify variables in the workspace that contain a string and save the identified variable with another name?
Assuming that you are LOADing some MAT files, then the best approach is to avoid your situation entirely, for example by LOADing...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
padding an array with zeros in between elements
Assuming that A is sorted, here is a simple approach: A = [7,15,21,29]; B = A(1):A(end); B(~ismember(B,A)) = 0 If A is not s...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Read and Sort Large Amount of Audio .wav Files
As far as I know, the only way to get get the correct order DATASTORE filenames without affecting other properties/attributes is...

plus de 2 ans il y a | 1

Réponse apportée
MATLAB null conditional operator
"How it could be done in most simple and elegant way?" I assume that the aim is to not change the logging calls within the proj...

plus de 2 ans il y a | 2

Réponse apportée
Error Message "Array indices must be positive integers or logical values" from importing .txt file and get plot
plot(time, Ion,'fileNames', fileNames{fileidx-1}); % ^^ get rid of this

plus de 2 ans il y a | 0

Réponse apportée
I have it reading from a struct with signal names and I want to extract it and input it into a 1 column array
The solution depends on the sizes of MESSAGES and SIGNALINFO (you did not tell us either of these). Perhaps this: out = {Messa...

plus de 2 ans il y a | 0

Réponse apportée
How to call a MATLAB variable loaded in from a .mat file when you don't know the name of the variable beforehand
"The easiest way would be to use eval():" Use STRUCT2CELL, e.g.: C = struct2cell(load(filename)); D = C{1}; Avoid LOADing di...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Why Does Format of Data Returned from readtable() Depend on Import Options that are Not VariableTypes?
"Is that expected behavior?" Yes. Or at least, not really very surprising. "Why Does Format of Data Returned from readtable()...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Find peaks in a matrix containing zeros
A = [1,3,-1,1,5,-1,0;1,6,3,-2,0,0,0;2,3,9,-2,1,11,-1;4,1,-2,8,5,0,0;2,-2,6,-1,0,0,0;-1,13,-2,0,0,0,0] F = @(a)findpeaks(a,'Thre...

plus de 2 ans il y a | 2

| A accepté

Réponse apportée
Plotting perpendicular lines but they are not perpendicular.
"But as you can see these do not show up as perpendicular." They are perpendicular: check the axes scales! If you want the X a...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Swap shape of cell array full of arrays
C = {[1,2,3,4,5], [1,2,3,4,5]; [1,2,3,4,5], [1,2,3,4,5]} F = @(a)reshape(a,1,1,[]); D = reshape(num2cell(cell2mat(cellfun(F,C,...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How to save current time in file name
You are trying to concatenate STRINGS... and that gives you STRING array with multiple elements, not a character vector nor a sc...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Find the 137th character in a file?
fnm = 'theNameOfYourFile.txt'; txt = fileread(fnm); txt(137)

plus de 2 ans il y a | 2

Réponse apportée
add internal parts of a vector
A = [1;1;1;1;1;3;4;8;1;1;1;2;9;1;1;1;1;4;1;1] X = A==1; Y = cumsum([1;diff(X)>0]); Z = accumarray(Y,X)

plus de 2 ans il y a | 2

Réponse apportée
error using system -- "Command argument must be either a nonmissing scalar string or a character row vector. "
"it seems the syntax of the assembled path/file to run is incorrect" True, it is a 1x6 string array. "but I don't know what it...

plus de 2 ans il y a | 2

| A accepté

Réponse apportée
interp3 problem: the value of the last sampling coordinate is not match.
"Any insights or suggestions on how to correctly interpolate the profile between p1 and p2 would be greatly appreciated." You a...

plus de 2 ans il y a | 1

Réponse apportée
Updating Structure Input for Functions
Do not use nested structures. Definitely do NOT use lots of variables each named after a fruit! Ugh, no. Use a structure array...

plus de 2 ans il y a | 3

| A accepté

Charger plus